Created
June 11, 2018 05:25
-
-
Save kunigami/408deb4fb39a6b4a4c866234d72a7151 to your computer and use it in GitHub Desktop.
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
var Caml_array = require("./stdlib/caml_array.js"); | |
function sum(arr) { | |
var v = 0; | |
for(var i = 0 ,i_finish = arr.length - 1 | 0; i <= i_finish; ++i){ | |
v = v + Caml_array.caml_array_get(arr, i) | 0; | |
} | |
return v; | |
} | |
console.log(sum(/* array */[ | |
10, | |
20, | |
30 | |
])); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment