Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Beyond JavaScript

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Beyond JavaScript

Given at JSConfEU 2011

Avatar for Jakob Mattsson

Jakob Mattsson

October 01, 2011

More Decks by Jakob Mattsson

Other Decks in Programming

Transcript

  1. list.select { |x| x > 0 } filter (> 0)

    list list.filter(function(x) { return x > 0 })
  2. && = lazyfunction(a, b) { if (execute(a)) { if (execute(b))

    { return true; } } return false; }; Call by name
  3. v = a + b unless x > y =>

    (x > y).unless(v = a + b) Operators on steroids
  4. filter = lazyfunction(msg) { var r = []; this.forEach(function(e) {

    if (e.send(msg)) { r.push(e); } }); return r; } Syntax unification