Skip to content

Instantly share code, notes, and snippets.

@gibo
Created March 10, 2017 14:55
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 gibo/2bef37a496ee5c4bc50b31ea08760dba to your computer and use it in GitHub Desktop.
Save gibo/2bef37a496ee5c4bc50b31ea08760dba to your computer and use it in GitHub Desktop.
kata
Cons.fromArray = function(array) {
array = array.reverse();
let last = new Cons(array.shift(), null);
array.forEach(function(item) {
last = new Cons(item, last);
});
return last;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment