Created
October 11, 2016 03:02
-
-
Save lubien/575f182a8b67bfd6c6df1289a30efdc7 to your computer and use it in GitHub Desktop.
Append implementation for https://courses.edx.org/courses/course-v1:LouvainX+Louv1.1x+3T2016
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
local AppendLists in | |
fun {AppendLists L1 L2} | |
local Aux in | |
fun {Aux List Acc} | |
case List of | |
Head|Tail then {Aux Tail (Head | Acc)} | |
else Acc | |
end | |
end | |
{Aux {Reverse L1} L2} | |
end | |
end | |
{Browse {AppendLists [1 2 3] [4 5 6]}} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fun {AppendList L1 L2} local Head in fun {Head H|T} if (T == nil) then H | L2 else H | {Head T} end end if (L1 == nil) then L2 else {Head L1} end end end