<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Languages of the real and artificial - Latest Comments in Functional JavaScript</title><link>http://osteele.disqus.com/</link><description></description><language>en</language><lastBuildDate>Thu, 27 Sep 2007 18:58:41 -0000</lastBuildDate><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881124</link><description>This library rocks!</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">David Mercer</dc:creator><pubDate>Thu, 27 Sep 2007 18:58:41 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881123</link><description>[...] E outro carinha criou uma biblioteca para escrever javascript funcional (map, reduce, filter), chamada &amp;#8220;Functional Javascript&amp;#8221; [...]</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Javascript como SmallTalk e Ja</dc:creator><pubDate>Mon, 13 Aug 2007 12:17:48 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881122</link><description>Thomas, you're right; thanks for the find and the fix.  I've fixed it above now.&lt;br&gt;&lt;br&gt;I wrote the code that splices the output values into the "examples page":http://osteele.com/sources/javascript/functional exactly because I knew I wouldn't successfully keep them up to date with the expressions, but I couldn't (or didn't take the time to) do the same thing on this blog page :-(</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Oliver</dc:creator><pubDate>Sat, 04 Aug 2007 14:58:21 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881120</link><description>Just a quick fix: The example&lt;br&gt;"map(guard('10+', not('%2')), [1,2,3,4])" in your Function-level programming section should probably produce&lt;br&gt;"-&amp;gt; [1,12,3,14]", or shouldn't it?!</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Thomas Herchenroeder</dc:creator><pubDate>Mon, 30 Jul 2007 07:13:25 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881119</link><description>[...] Jul 27th, 2007 by kiterminal    à¸§à¸±à¸™à¸™à¸µà¹‰à¸šà¸±à¸‡à¹€à¸­à¸´à¸à¹„à¸›à¹€à¸ˆà¸­ Blog à¸‚à¸­à¸‡ Oliver Steele à¸‹à¸¶à¹ˆà¸‡à¹€à¸„à¹‰à¸²à¹„à¸›à¸—à¸³ Functional JavaScript à¹„à¸§à¹‰ à¸¥à¸­à¸‡à¸¡à¸²à¸”à¸¹à¸•à¸±à¸§à¸­à¸¢à¹ˆà¸²à¸‡à¸—à¸µà¹ˆà¹€à¸„à¹‰à¸²à¸—à¸³à¹ƒà¸«à¹‰à¸”à¸¹à¸¥à¸°à¸à¸±à¸™  map(function(x){return x+1}, [1,2,3]) -&amp;gt; [2,3,4] filter(function(x){return x&amp;gt;2}, [1,2,3,4]] -&amp;gt; [3,4] some(function(w){return w.length &amp;lt; 3}, &amp;#8216;are there any short words?&amp;#8217;.split(&amp;#8217; &amp;#8216;)) -&amp;gt; false // double the items in a list: map(&amp;#8217;*2&amp;#8242;, [1,2,3]) -&amp;gt; [2, 4, 6] // find just the odd numbers: filter(&amp;#8217;%2&amp;#8242;, [1,2,3,4]) -&amp;gt; [1, 3] // or just the evens: filter(not(&amp;#8217;%2&amp;#8242;), [1,2,3,4]) -&amp;gt; [2, 4]  à¸—à¸±à¹‰à¸‡à¸™à¸µà¹‰à¹€à¸„à¹‰à¸²à¸¢à¸±à¸‡à¹„à¸”à¹‰à¸—à¸³ API documentation à¹„à¸§à¹‰à¹ƒà¸«à¹‰à¸­à¹ˆà¸²à¸™à¹à¸¥à¸°à¸¨à¸¶à¸à¸©à¸²à¸à¸±à¸™à¸”à¹‰à¸§à¸¢ [...]</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Functional JavaScript « Kiterm</dc:creator><pubDate>Thu, 26 Jul 2007 22:42:21 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881118</link><description>We had wrote such library for our product, as almost all developers was experienced Scheme developers ;-)&lt;br&gt;JavaScript code in functional looks very elegant and readable</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Ott</dc:creator><pubDate>Thu, 26 Jul 2007 09:23:51 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881117</link><description>[...] Functional&amp;nbsp;Javascript  26 07 2007   Currently i am working on Javascript and i am learning a lot.While searching for some code samples in Javascript I came across a new term Functional Javascript.We all know what is &amp;#8220;Functions&amp;#8221; in javascript.But what is functional javascript???Let&amp;#8217;s see. [...]</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Functional Javascript « Bloomi</dc:creator><pubDate>Thu, 26 Jul 2007 08:12:54 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881116</link><description>[...] Functional JavaScript at Oliver Steele (tags: javascript functional) [...]</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jhorman.org - links for 2007-0</dc:creator><pubDate>Tue, 24 Jul 2007 21:31:04 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881115</link><description>[...] Oliver Steele has a new library called Functional JavaScript that defines the standard higher-order functions (map, reduce, filter) as well as functions for partial function application and function-level programming: curry, partial, compose, guard, and until. Finally, it introduces â€œstring lambdasâ€, which let you write 'x -&amp;gt; x+1', 'x+1', or even '+1' as synonyms for function(x) {return x+1}. [...]</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ajaxian » Functional JavaScrip</dc:creator><pubDate>Tue, 24 Jul 2007 14:46:54 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881114</link><description>[...] Functional JavaScript at Oliver Steele In most languages, including JavaScript, invoking a function is one of the slowest things you can do. The implementations of languages designed for functional programming use a variety of techniques to optimize function calls. JavaScript is not one of tho (tags: JavaScript webdesign)    digg_url='http://xiled.rss-central.net/blog/2007/07/23/links-for-2007-07-24/'; digg_skin = 'compact'; digg_bgcolor = '#FFFFFF'; digg_title = 'links for 2007-07-24'; digg_bodytext = ''; digg_topic = '';   Powered by Gregarious (41) Share This [...]</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">links for 2007-07-24</dc:creator><pubDate>Tue, 24 Jul 2007 02:28:40 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881112</link><description>[...] Functional JavaScript at Oliver Steele &amp;#8220;In most languages, including JavaScript, invoking a function is one of the slowest things you can do. The implementations of languages designed for functional programming use a variety of techniques to optimize function calls. JavaScript is not one of th (tags: functional fp declarative map reduce filter mapreduce javascript viapopular) [...]</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">links for 2007-07-24 « Talkabo</dc:creator><pubDate>Tue, 24 Jul 2007 01:26:44 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881111</link><description>[...] Functional JavaScript at Oliver Steele (tags: ** article development filter functions functional programming javascript library webdev haskell guide) [...]</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">links for 2007-07-24 « Simply…</dc:creator><pubDate>Mon, 23 Jul 2007 22:44:06 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881110</link><description>[...] Functional JavaScript (tags: programming javascript) [...]</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">links for 2007-07-24 « Bloggit</dc:creator><pubDate>Mon, 23 Jul 2007 22:23:22 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881109</link><description>[...] Functional JavaScript at Oliver Steele Functional is a JavaScript library for functional programming, a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. (tags: article filter javascript library programming tutorial tips functional development webdev webdesign) [...]</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Christopher Schmitt</dc:creator><pubDate>Mon, 23 Jul 2007 18:27:12 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881108</link><description>I'm having great fun pouring over your library. It is very well written and I'm learning a lot about functional programming from reading the source.&lt;br&gt;&lt;br&gt;Regarding speed, you can improve performance by giving up your favourite idiom:&lt;br&gt;&lt;br&gt;var args = [].slice.call(arguments, 0);&lt;br&gt;&lt;br&gt;This is expensive because it creates a new Array object every time you slice an arguments object. Which is very often.&lt;br&gt;&lt;br&gt;Mozilla provides a static slice method on the Array object. Or you can fake it yourself:&lt;br&gt;&lt;br&gt;if (!Array.slice) { // Mozilla already supports this&lt;br&gt;  Array.slice = function(array) {&lt;br&gt;    // Slice an array-like object.&lt;br&gt;    var slice = Array.prototype.slice;&lt;br&gt;    return slice.apply(array, slice.call(arguments, 1));&lt;br&gt;  };&lt;br&gt;}&lt;br&gt;&lt;br&gt;And use it like this:&lt;br&gt;&lt;br&gt;var args0 = Array.slice(arguments);    // cast to Array&lt;br&gt;var args1 = Array.slice(arguments, 1); // a normal slice&lt;br&gt;&lt;br&gt;I use it so often I make it global.&lt;br&gt;&lt;br&gt;var slice = Array.slice;&lt;br&gt;var args = slice(arguments);&lt;br&gt;&lt;br&gt;Hope that helps. Back to reading your source code for me. :)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dean Edwards</dc:creator><pubDate>Mon, 23 Jul 2007 18:22:34 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881107</link><description>[...] Did you ever use Haskell?Haskell is a functional programming language (you&amp;#8217;ll soon see what it means), and now, there&amp;#8217;s a library for Functional JavaScript.And that&amp;#8217;s what you can do with it: instead of&amp;#8230;var numbers = [2, 93, 8894, 491, 7]; var sum = 0; for( var i = 0; i &amp;lt; 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) ); // &amp;quot;3&amp;quot;! So&amp;#8230; This is really, really hot so far. What&amp;#8217;s missing are good functions for working with lists (or even List comprehension). Also, I&amp;#8217;d doubt that this has good performance. However, especially in web desing, while working with DOM or those things, I&amp;#8217;m sure Functional JavaScript will find it&amp;#8217;s place.Give it a try, it&amp;#8217;s hot! (And use the &amp;quot;live demo feature&amp;quot; on the site linked above!  ) [...]</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">JaskellScript - the contented</dc:creator><pubDate>Mon, 23 Jul 2007 17:18:27 -0000</pubDate></item><item><title>Re: Functional JavaScript</title><link>http://osteele.com/archives/2007/07/functional-javascript#comment-4881106</link><description>I think it would be more readable if the map/filter/reduce functions worked on the enumerable objects themselves instead of having to be passed in.&lt;br&gt;&lt;br&gt;Instead of this:&lt;br&gt;map('x*x', [1,2,3,4])&lt;br&gt;&lt;br&gt;Why not this:&lt;br&gt;[1,2,3,4].map('x*x')</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">sbecker</dc:creator><pubDate>Mon, 23 Jul 2007 15:24:55 -0000</pubDate></item></channel></rss>