<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Notes on Javascript and Actionscript</title>
	<atom:link href="http://javascriptandactionscript.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://javascriptandactionscript.wordpress.com</link>
	<description></description>
	<lastBuildDate>Wed, 08 Jul 2009 19:50:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='javascriptandactionscript.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Notes on Javascript and Actionscript</title>
		<link>http://javascriptandactionscript.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://javascriptandactionscript.wordpress.com/osd.xml" title="Notes on Javascript and Actionscript" />
	<atom:link rel='hub' href='http://javascriptandactionscript.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Setting Properties with Anonymous Functions</title>
		<link>http://javascriptandactionscript.wordpress.com/2009/07/08/setting-properties-with-anonymous-functions/</link>
		<comments>http://javascriptandactionscript.wordpress.com/2009/07/08/setting-properties-with-anonymous-functions/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 19:50:52 +0000</pubDate>
		<dc:creator>chunkyslink</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://javascriptandactionscript.wordpress.com/?p=25</guid>
		<description><![CDATA[function pp(val) { console.log( val ); } var neil = { name : function(n){ pp( "my name is: " + n) }, email : function(n){ pp( "my email is: " + n ) } } neil.name( "neil" ); neil.email( "caphonic@gmail.com" );<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javascriptandactionscript.wordpress.com&amp;blog=8259265&amp;post=25&amp;subd=javascriptandactionscript&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<pre>

function pp(val)
{
console.log( val );
}

var neil =
{
name : function(n){ pp( "my name is: " + n) },
email : function(n){ pp( "my email is: " + n ) }
}
neil.name( "neil" );
neil.email( "caphonic@gmail.com" );
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/javascriptandactionscript.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/javascriptandactionscript.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/javascriptandactionscript.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/javascriptandactionscript.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/javascriptandactionscript.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/javascriptandactionscript.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/javascriptandactionscript.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/javascriptandactionscript.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/javascriptandactionscript.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/javascriptandactionscript.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/javascriptandactionscript.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/javascriptandactionscript.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/javascriptandactionscript.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/javascriptandactionscript.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javascriptandactionscript.wordpress.com&amp;blog=8259265&amp;post=25&amp;subd=javascriptandactionscript&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://javascriptandactionscript.wordpress.com/2009/07/08/setting-properties-with-anonymous-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0cd90022790980adeadd64fb02e30e3b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chunkyslink</media:title>
		</media:content>
	</item>
		<item>
		<title>Abstracting Array Iterators with Anonymous Functions</title>
		<link>http://javascriptandactionscript.wordpress.com/2009/06/21/abstracting-array-iterators-with-anonymous-functions/</link>
		<comments>http://javascriptandactionscript.wordpress.com/2009/06/21/abstracting-array-iterators-with-anonymous-functions/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 20:02:43 +0000</pubDate>
		<dc:creator>chunkyslink</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[functional-programming]]></category>

		<guid isPermaLink="false">http://javascriptandactionscript.wordpress.com/?p=6</guid>
		<description><![CDATA[An anonymous function in Javascript is a function without a name. It is not possible to write an anonymous function on its own but you if you could it would look like this function() { alert( "You pressed the mouse button" ); } One use of anonymous functions is to pass them as arguments to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javascriptandactionscript.wordpress.com&amp;blog=8259265&amp;post=6&amp;subd=javascriptandactionscript&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>An anonymous function in Javascript is a function without a name. It is not possible to write an anonymous function on its own but you if you could it would look like this</p>
<pre>function() { alert( "You pressed the mouse button" ); }</pre>
<p>One use of anonymous functions is to pass them as arguments to other functions.</p>
<blockquote><p>If a function doesn&#8217;t have a name, and it&#8217;s just another value in the machine, then functions in Javascript are much closer to data than what we would consider traditional functions and objects. It&#8217;s data that does stuff to be sure, but in every place that matters, learning to look at the function as a piece of active data will really help you out when it comes to figuring out just how to apply this technology. <em><a href="http://www.hunlock.com/blogs/Functional_Javascript">hunlock.com</a></em></p></blockquote>
<p>First lets look at a function that abstracts iterating over an array so that we can use an anonymous function to actually do something interesting.<br />
Looping over an array and applying an action to it is easy. Take the following code:</p>
<pre>function forEach(array, action) {
  for (var i = 0; i &lt; array.length; i++)
    action(array[i]);
}

forEach (["Neil", "Jen", "Nelson"], console.log);
forEach (["Neil", "Jen", "Nelson"], alert);</pre>
<p>The first sends each item of the array to the console and the second to the alert() function.</p>
<p>Now lets define a function called map will use the iterator function forEach() that we&#8217;ve defined above and call it.</p>
<pre>function map(func, array) {
  var result = [];
  forEach(array, function (element) {
    result.push(func(element));
  });
  return result;
}

map( Math.round, [0.01, 2, 9.89, Math.PI] );

#outputs - [0, 2, 10, 3]</pre>
<p>So the first argument is a function that rounds each one of the following array items.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/javascriptandactionscript.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/javascriptandactionscript.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/javascriptandactionscript.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/javascriptandactionscript.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/javascriptandactionscript.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/javascriptandactionscript.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/javascriptandactionscript.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/javascriptandactionscript.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/javascriptandactionscript.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/javascriptandactionscript.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/javascriptandactionscript.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/javascriptandactionscript.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/javascriptandactionscript.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/javascriptandactionscript.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=javascriptandactionscript.wordpress.com&amp;blog=8259265&amp;post=6&amp;subd=javascriptandactionscript&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://javascriptandactionscript.wordpress.com/2009/06/21/abstracting-array-iterators-with-anonymous-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0cd90022790980adeadd64fb02e30e3b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chunkyslink</media:title>
		</media:content>
	</item>
	</channel>
</rss>
