Skip to content

Instantly share code, notes, and snippets.

@kunishi
Created January 29, 2014 10:19
Show Gist options
  • Select an option

  • Save kunishi/8685159 to your computer and use it in GitHub Desktop.

Select an option

Save kunishi/8685159 to your computer and use it in GitHub Desktop.
val rec padd = fn
(P, nil) => P
| (nil, Q) => Q
| ((p:real)::ps, q::qs) => (p+q)::padd(ps, qs);
val rec smult = fn
(nil, q) => nil
| ((p:real)::ps, q) => (p*q)::smult(ps, q);
val rec pmult = fn
(P, nil) => nil
| (P, q::qs) => padd(smult(P, q), 0.0::pmult(P, qs));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment