Skip to content

Instantly share code, notes, and snippets.

@kunishi
Created January 29, 2014 10:22
Show Gist options
  • Save kunishi/8685216 to your computer and use it in GitHub Desktop.
Save kunishi/8685216 to your computer and use it in GitHub Desktop.
val sqrt = Math.sqrt;
fun simpleMap(f, nil) = nil
| simpleMap(f, x::xs) = f(x) :: simpleMap(f, xs);
fun vec_length(L) = simpleMap(fn (x, y) => sqrt(x * x + y * y), L);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment