Created
October 7, 2010 06:54
-
-
Save draftcode/614683 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun {Flatten Xs} | |
case Xs | |
of nil then nil | |
[] X|Xr andthen {IsList X} then | |
{Append {Flatten X} {Flatten Xr}} | |
[] X|Xr then | |
X|{Flatten Xr} | |
end | |
end | |
fun {Flatten Xs} | |
proc {FlattenD Xs E} | |
case Xs | |
of nil then E | |
[] X|Xr andthen {IsList X} then | |
{FlattenD X {FlattenD Xr E}} | |
[] X|Xr then | |
X|{FlattenD Xr E} | |
end | |
end | |
in {FlattenD Xs nil} end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment