这是indexloc提供的服务,不要输入任何密码
Skip to content

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

@chr15m

Description

@chr15m

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; }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions