Skip to content

Instantly share code, notes, and snippets.

@lubien
Created October 11, 2016 03:02
Show Gist options
  • Save lubien/575f182a8b67bfd6c6df1289a30efdc7 to your computer and use it in GitHub Desktop.
Save lubien/575f182a8b67bfd6c6df1289a30efdc7 to your computer and use it in GitHub Desktop.
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
@brcb20
Copy link

brcb20 commented Oct 15, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment