Skip to content

Instantly share code, notes, and snippets.

@eff-kay
Created January 10, 2023 16:19
Show Gist options
  • Save eff-kay/4db6e39b5d845b4f711600ad3fd61c57 to your computer and use it in GitHub Desktop.
Save eff-kay/4db6e39b5d845b4f711600ad3fd61c57 to your computer and use it in GitHub Desktop.
fun prepend(xs: int list, ys: int list)=
if null xs
then ys
else (hd xs):: prepend( (tl xs), ys);
val xs = [4,5,6];
val ys = [1,2,3];
(* [4,5,6, 1,2,3] *)
prepend(xs, ys);
val xs = [7,8,9];
(* [7,8,9, 1,2,3] *)
prepend(xs, ys);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment