Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Created August 10, 2014 16:24
Show Gist options
  • Save trikitrok/52e9f7e1a8aaa80950a0 to your computer and use it in GitHub Desktop.
Save trikitrok/52e9f7e1a8aaa80950a0 to your computer and use it in GitHub Desktop.
fun append(xs, ys) =
case xs of
[] => ys
| head::tail => head::append(tail, ys)
val testAppend1 = append([1, 2, 3, 4], [5, 6, 7])
(* val testAppend1 = [1,2,3,4,5,6,7] : int list *)
val testAppend2 = append([], [5, 6, 7])
(* val testAppend2 = [5,6,7] : int list *)
val testAppend3 = append([1, 2, 3, 4], [])
(* val testAppend3 = [1,2,3,4] : int list *)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment