2011/5/29 Dmitry A. Soshnikov <dmitry.soshni...@gmail.com> > Hi, > > Don't get this proposal as a bikesheding, just an idea in case if arrow > functions will win the block-functions. > > What about to make a sugar for Array comprehensions based also on arrow > syntax? The same as in Erlang: > > let data = [1, 2, 3, 4, 5]; > > let squares = [x * x | x <- data, x > 3]; // [16, 25] >
Basically you are proposing bring in Haskell's syntax for comprehensions > 3. Of course it's assumed that we can destructure elements in such array > comprehensions: > > let users = [ > {name: "Alex", age: 31}, > {name: "John", age: 25}, > {name: "Mark", age: 33} > ]; > > let names = [name | {name, age} <- users, age > 30]; // ["Alex", "Mark"] > This form of located flat pattern matching is good. Jose.
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss