Permalink
Browse files

Add FlattenList

  • Loading branch information...
1 parent d904002 commit 71fe1077e88eddaad39917383e92c3723e3c70a7 @laurentpetit committed Mar 6, 2014
Showing with 11 additions and 0 deletions.
  1. +11 −0 FlattenList.oz
View
11 FlattenList.oz
@@ -0,0 +1,11 @@
+declare
+fun {FlattenList L}
+ case L
+ of nil then nil
+ [] nil|T then {FlattenList T}
+ [] (H1|T1)|T then {FlattenList H1|T1|T}
+ [] X|T then X | {FlattenList T}
+ end
+end
+
+{Browse {FlattenList [[1 nil [3] 4]]}}

0 comments on commit 71fe107

Please sign in to comment.