News for hackers. Stuff that matters.
Re:Usefulness of inventing programming languages by DaveInTucson on Tuesday April 26, 2011 @12:43PM (#2486047)
why this does not work: [1,2,3].map({2:4}) (in JavaScript)?

It does (or, at least, it can) if you give Array.prototype.map a suitable value. Here's one possible implementation:

  Array.prototype.map = function(o) {
    var copy = this.slice(0); // copy semantics
    for (var i in o) copy[i] = o[i];
    return copy;
  }

There are no comments on this comment yet.