Created
October 5, 2017 20:03
-
-
Save viebel/de19a9c8827f887d1f9ae4568decb0de to your computer and use it in GitHub Desktop.
Sigma in reason
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec sigma f s => | |
switch s { | |
| [] => 0 | |
| [x, ...l] => f x + sigma f l | |
}; | |
let () = Js.log (sigma (fun x => x * x) [1, 2, 3]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment