Skip to content

Instantly share code, notes, and snippets.

@asvnpr
Created April 6, 2016 17:07
Show Gist options
  • Save asvnpr/af0ba6a1db4a06e5e9a3903f00146c45 to your computer and use it in GitHub Desktop.
Save asvnpr/af0ba6a1db4a06e5e9a3903f00146c45 to your computer and use it in GitHub Desktop.
1.)
fun squareSum nil = 0
| squareSum(h::t) = h*h + squareSum(t);
how do tail recursive halp
2.)
fun secondSmall (null, s) = nil
| secondSmall (h::t, s) =
if (s > List.nth(t, 0) or s = nil)
s = h
secondSmall(t, List.nth(t, 0))
else
secondSmall(t, s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment