[...] Did you ever use Haskell?Haskell is a functional programming language (you’ll soon see what it means), and now, there’s a library for Functional JavaScript.And that’s what you can do with it: instead of…var numbers = [2, 93, 8894, 491, 7]; var sum = 0; for( var i = 0; i < numbers.length; i++ ) { sum += numbers[i] * 20; alert(sum); You would just say:alert( reduce( 'x+y', 0, map('*20', [2,93,8894,491,7]) ) );Okay, while this is just some loosy nonsense example, the possibilities opened up by the library are huge. Still, the greatest benefits from Functional JavaScript are higher order functions: now, even Currying or partial function application are possible!Look here:// Create functions on the fly! var divide = 'x/y'.lambda(); // Apply only one parameter and create a new function. var halve = divide.partial(_,2); alert( halve(6) ); // "3"! So… This is really, really hot so far. What’s missing are good functions for working with lists (or even List comprehension). Also, I’d doubt that this has good performance. However, especially in web desing, while working with DOM or those things, I’m sure Functional JavaScript will find it’s place.Give it a try, it’s hot! (And use the "live demo feature" on the site linked above! ) [...]
Oliver Steele lives in Western Massachusetts and commutes to downtown LA, where he is bringing an operating system from handwaving to reality. He was the architect of OpenLaszlo, the author of PyWordNet and other open source projects. His interests include programming languages, knowledge representation, information visualization, and math education. [more]
[...] Did you ever use Haskell?Haskell is a functional programming language (you’ll soon see what it means), and now, there’s a library for Functional JavaScript.And that’s what you can do with it: instead of…var numbers = [2, 93, 8894, 491, 7]; var sum = 0; for( var i = 0; i < numbers.length; i++ ) { sum += numbers[i] * 20; alert(sum); You would just say:alert( reduce( 'x+y', 0, map('*20', [2,93,8894,491,7]) ) );Okay, while this is just some loosy nonsense example, the possibilities opened up by the library are huge. Still, the greatest benefits from Functional JavaScript are higher order functions: now, even Currying or partial function application are possible!Look here:// Create functions on the fly! var divide = 'x/y'.lambda(); // Apply only one parameter and create a new function. var halve = divide.partial(_,2); alert( halve(6) ); // "3"! So… This is really, really hot so far. What’s missing are good functions for working with lists (or even List comprehension). Also, I’d doubt that this has good performance. However, especially in web desing, while working with DOM or those things, I’m sure Functional JavaScript will find it’s place.Give it a try, it’s hot! (And use the "live demo feature" on the site linked above! ) [...]