Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naive JS shims make tiny builds of CLJS code using Wisp possible #161

Open
chr15m opened this issue May 1, 2019 · 1 comment
Open

Naive JS shims make tiny builds of CLJS code using Wisp possible #161

chr15m opened this issue May 1, 2019 · 1 comment

Comments

@chr15m
Copy link
Collaborator

chr15m commented May 1, 2019

Recently I had to port a small bit of ClojureScript code to Wisp and the following shims helped me. Would be good to get these into Wisp itself.

function count(x) { return x.length; }
function mapIndexed(f, a) { return a.map(function(l, i) { return f(i,l);}); }
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);
  };
}

The following should be done better and/or implemented properly:

function doall(x) { return x; }
function isEqual(a, b) { return a == b; }
@chr15m
Copy link
Collaborator Author

chr15m commented May 1, 2019

@rcarmo since you are active in the source I wanted to run these by you too.

@chr15m chr15m changed the title Some shims for various Clojure compatability issues Naive JS shims make tiny builds of CLJS code using Wisp possible Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant