Skip to content

Instantly share code, notes, and snippets.

@kunigami
Created June 11, 2018 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunigami/408deb4fb39a6b4a4c866234d72a7151 to your computer and use it in GitHub Desktop.
Save kunigami/408deb4fb39a6b4a4c866234d72a7151 to your computer and use it in GitHub Desktop.
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