UNPKG

wisp

Version:

Homoiconic JS with clojure syntax, s-expressions & macros

24 lines (23 loc) 742 B
// dirty hacks to allow some common cljs calls in a light interface // you probably shouldn't use this function count(x) { return x.length; } function doall(x) { return x; } function mapIndexed(f, a) { return a.map(function(l, i) { return f(i,l);}); } function isEqual(a, b) { return JSON.stringify(a) == JSON.stringify(b); } function partial(fn) { var slice = Array.prototype.slice; var stored_args = slice.call(arguments, 1); return function () { var new_args = slice.call(arguments); var args = stored_args.concat(new_args); return fn.apply(null, args); }; } function assoc(t) { var args = slice.call(arguments, 1); for (var k=0; k<args.length/2; k+=2) { t[args[k]] = args[k+1]; } return t; } exports = {};