<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5623577383635787454</id><updated>2012-01-04T14:59:38.309-08:00</updated><category term='*'/><title type='text'>Journey From Imperative to Functional Programming</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>36</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-5472449403322073038</id><published>2012-01-04T14:51:00.000-08:00</published><updated>2012-01-04T14:59:38.329-08:00</updated><title type='text'></title><content type='html'>I like this &lt;a href="http://www.valuedlessons.com/2008/04/you-could-have-invented-monadic-parsing.html"&gt;post&lt;/a&gt; on  what monadic parsers are and where they are useful.    &lt;br /&gt;&lt;br /&gt;This &lt;a href="http://stackoverflow.com/questions/7861903/what-are-the-benefits-of-applicative-parsing-over-monadic-parsing"&gt;exchange&lt;/a&gt; further explains when you need monadic power.  &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;....use the simplest tool which gets the job done. Don't use a fork lift when a dolly will do. Don't use a table saw to cut out coupons. Don't write code in IO when it could be pure. Keep it simple.&lt;br /&gt;&lt;br /&gt;But sometimes, you need the extra power of Monad. A sure sign of this is when you need to change the course of the computation based on what has been computed so far. In parsing terms, this means determining how to parse what comes next based on what has been parsed so far; in other words you can construct context-sensitive grammars this way.&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-5472449403322073038?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/5472449403322073038/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=5472449403322073038' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/5472449403322073038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/5472449403322073038'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2012/01/i-like-this-post-on-what-monadic.html' title=''/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-2195320584685704903</id><published>2011-12-20T17:41:00.001-08:00</published><updated>2011-12-20T17:46:49.556-08:00</updated><title type='text'>Usecase and Aspect</title><content type='html'>Aspect programming feels to me like adding functional thinking in OO.    An article from a few years ago that sounds interesting&lt;br /&gt;http://www.jot.fm/issues/issue_2003_07/column1.pdf and slides http://aosd.net/archive/2003/jacobson-aosd-2003.ppt&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-2195320584685704903?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/2195320584685704903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=2195320584685704903' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/2195320584685704903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/2195320584685704903'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2011/12/usecase-and-aspect.html' title='Usecase and Aspect'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-7937801648067104081</id><published>2011-03-15T17:07:00.000-07:00</published><updated>2011-03-15T17:07:07.381-07:00</updated><title type='text'>An interesting talk...  Riak Core: Dynamo Building Blocks</title><content type='html'>&lt;a href="http://www.infoq.com/presentations/Riak-Core"&gt;InfoQ: Riak Core: Dynamo Building Blocks&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-7937801648067104081?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.infoq.com/presentations/Riak-Core' title='An interesting talk...  Riak Core: Dynamo Building Blocks'/><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/7937801648067104081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=7937801648067104081' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/7937801648067104081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/7937801648067104081'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2011/03/interesting-talk-riak-core-dynamo.html' title='An interesting talk...  Riak Core: Dynamo Building Blocks'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-1858698914564958832</id><published>2011-01-28T23:58:00.001-08:00</published><updated>2011-01-28T23:58:51.778-08:00</updated><title type='text'>Logic Book online</title><content type='html'>An interesting logic book online. &lt;a href="http://www.logicinaction.org/"&gt;  Logic in Action&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-1858698914564958832?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/1858698914564958832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=1858698914564958832' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/1858698914564958832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/1858698914564958832'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2011/01/logic-book-online.html' title='Logic Book online'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-4104318467160302407</id><published>2011-01-24T00:49:00.001-08:00</published><updated>2011-01-24T00:49:41.832-08:00</updated><title type='text'>Good examples on Arrows</title><content type='html'>I like this &lt;a href="http://blog.romanandreg.com/post/2755301358/on-how-haskells-are-just-might-just-be-function"&gt;examples&lt;/a&gt; of Arrows.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-4104318467160302407?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/4104318467160302407/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=4104318467160302407' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/4104318467160302407'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/4104318467160302407'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2011/01/good-examples-on-arrows.html' title='Good examples on Arrows'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-4692482782559020986</id><published>2011-01-19T12:38:00.000-08:00</published><updated>2011-01-19T13:13:34.855-08:00</updated><title type='text'>Finding largest rectangular area without trees</title><content type='html'>In an interview I was asked a question very similar to &lt;a href="http://www.seas.gwu.edu/~simhaweb/cs151/lectures/module6/module6.html"&gt;this&lt;/a&gt; or &lt;a href="http://www.drdobbs.com/database/184410529"&gt;this&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In my version there is a rectangular piece of land with trees on it.  We know the coordinates of the land and the location of the trees on the land.  Goal is to find the largest contiguous rectangular area within our land that doesn't contain any trees.&lt;br /&gt;&lt;br /&gt;Solving these problems require you to develop the properties of the problem that then you can base an algorithm on for which there is no time.  My response in the interview was what I consider brute force method of trying to take a square and see how big it can grow.  Then try to find the largest one.  &lt;br /&gt;&lt;br /&gt;But thinking about the problem more I said what if I had a land and one tree.  Then I get essentially 4 areas.  Now if I have two trees, I should be able to take the areas from the first tree and check to see if the 2nd tree would influence them. If the 2nd tree is inside an area, then it would give me potentially 4  areas to work with.  That is the one area is replaced with up to 4 (removing the original one).  If there are no tree in the area then the area is unaffected by the 2nd tree.  So now I can try the 3rd, 4th... tree.    Each time check the effect of the tree on the land.  At the end the one with the largest area is my answer.   This solution doesn't care about the size of the land, just the number of trees.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/leaf?id=0B0MMAEYeDOlWYWJhOGMxMjUtY2U1MS00NDA4LWFmZTEtZWQ4ZDdiNWY5YjNk&amp;hl=en"&gt;Here&lt;/a&gt; is what I wrote in Haskell that I think solves the problem.   The implementation takes advantage of &lt;a href="http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Monad.html#v:foldM"&gt;foldM&lt;/a&gt; library to do most of the work. In foldM signature, "a" is my land, "b" is the tree, and  "ma" is List of a which is a list of land pieces.  Any feedback is appreciated.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-4692482782559020986?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/4692482782559020986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=4692482782559020986' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/4692482782559020986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/4692482782559020986'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2011/01/finding-largest-rectangular-area.html' title='Finding largest rectangular area without trees'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-3026411359182012172</id><published>2011-01-16T19:14:00.000-08:00</published><updated>2011-02-27T21:04:36.374-08:00</updated><title type='text'>How glues make a difference</title><content type='html'>There are folks that &lt;a href="http://www.paulgraham.com/gh.html"&gt;say&lt;/a&gt;  programming language does matter.  Some compare it to &lt;a href="http://www.infoq.com/interviews/john-hughes-fp#"&gt;glue&lt;/a&gt;  that  allow you freedom to build parts from smaller part.  It was hard for me to appreciate this until I saw real examples.  What I have learned is that with right glue your imagination can be liberated to think about possibilities and that is what make the choice of language matter.&lt;br /&gt;&lt;br /&gt;Lets take the problem of a simple game.  Let say you want to write code to implement the paddle ball.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.haskell.org/wikiupload/c/ce/PaddleBall.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 307px; height: 263px;" src="http://www.haskell.org/wikiupload/c/ce/PaddleBall.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you think Object Oriented about this game.  You see Ball, Paddle, Wall, Score.....  OO techniques would give you a great way to organize your code.  All the code concerning Ball would be encapsulate in the Ball object.   Then the key design decision  you need to make for the Ball, Paddle and Wall  objects is how to detect collision between Ball and Paddle or Wall. Then figure out who does the bounce of the ball.  Is the ball object going to detect the bounce, is the wall telling the ball to bounce...  So you put on your &lt;a href="http://www.evanetics.com/Articles/ar_objectModeling/MilkingAnOOCow.pdf"&gt;"Object Think"&lt;/a&gt; hat on.   Is it the ball that is detecting the collision, the wall?  Hmmmm   "Trying to Object Think and nothing is happening.  You give up, may be the Collision Manager that watches over all objects is simpler to think about!  Object Think =&gt; Let manager decide :)   You also need to worry about user input controlling the Paddle.  Is the code event driven (Inversion of Control)  or is it polling for the inputs....   &lt;br /&gt;&lt;br /&gt;However you decide to slice the implementation among your object, one thing is going to be true.  You are only thinking about the objects in the paddle game.  At best you may be able to reuse your ideas in similar game.  But the design, if you call what you are doing here as design, is adhoc and has very limited potential.  &lt;br /&gt;&lt;br /&gt;If you step back and drop your OO thinking and start looking at problem differently you be surprised at how all games are the same and hence can be implemented on common model. &lt;br /&gt;&lt;br /&gt;If you think of the game as a computation instead of bunch of object then it all looks different.   You ask yourself what is nature of the computation in this game?  One possible answer is to see the game as Interactive (user controls the paddle via key inputs) Animation (graphics that changes over time).   You can further define Animation as time-series (functions of time) graphics.  So now you have three different concepts.   Interactive, Time-Series, and Graphics.  Sum of them would give you the language to express the game while  each one of those ideas can be viewed by itself.   What would Interactive computation need to have?  What would Time-Series computation need?   and finally what would Graphics packages need to have to be fully expressive.  In all three cases you are asking yourself the compositional needs of each of your concern and define a language for it.   For instance, on the graphics you will define a language to have simple shapes, complex shapes as and/or/xor of simple shapes, transposition of shapes..... Most likely you will find an existing library that defines appropriate DSL for each of the concerns of our game.   &lt;br /&gt;&lt;br /&gt;Ideally you want a programming language  that allows you to compose notions (in this case interactive, animation, and graphics) in one grand notion such that you can express your game in.    So you say key x causes mouse to go left, or right, ball travels at some velocity (speed and direction), when the ball hits wall or paddle it bounces ( you defined a bounce as change in the direction of velocity).   If ball passes the edge it is outside, game is over..  You are done.   It is all basically the description of the game.   Even better, you can reuse the same notions and may be describe the car racing game.   If the approach interest you, you can get more details in &lt;a href="http://plucky.cs.yale.edu/soe/"&gt;SOE&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;All of sudden in the new perspective you have something that is truly re-usable.   You may be able to implement this in Java too.   But the key idea, as we saw here,  is that the standard OO techniques leads you to a dead end, you are worrying about non issues and the result has limited potential.  Furthermore, where your native language doesn't give you the compositional capabilities you need, you be forced to try to figure out ways to implement them.   It may be verbose, ugly and hard to understand which is why most people end up with mainstream usage model of the language.  &lt;br /&gt;&lt;br /&gt;So that is how the language does matter.   Glues make it all possible to build powerful abstraction.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-3026411359182012172?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/3026411359182012172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=3026411359182012172' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3026411359182012172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3026411359182012172'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2011/01/there-are-folks-that-say-programming.html' title='How glues make a difference'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-4277127478266329773</id><published>2011-01-15T17:41:00.000-08:00</published><updated>2011-01-16T18:54:07.571-08:00</updated><title type='text'>Wiggle room to exploit alternate representations and implementations.</title><content type='html'>A nice &lt;a href="http://www.infoq.com/presentations/Thinking-Parallel-Programming"&gt;presentation&lt;/a&gt; on Parallel programming.&lt;br /&gt;&lt;br /&gt;My Favorit slide: &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Algebraic Properties Are Important!&lt;br /&gt;• Associative: grouping doesn’t matter!&lt;br /&gt;• Commutative: order doesn’t matter!&lt;br /&gt;• Idempotent: duplicates don’t matter!&lt;br /&gt;• Identity: this value doesn’t matter!&lt;br /&gt;• Zero: other values don’t matter!&lt;br /&gt;Invariants give the implementation wiggle room, that is, the&lt;br /&gt;freedom to exploit alternate representations and implmentations.&lt;br /&gt;In particular, associativity gives implementations the necessary&lt;br /&gt;wiggle room to use parallelism—or not—as resources dictate.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;My favorite comment was about the C language having the address of operator (pointers).  Whereas a Java program has no such thing and thus JVM can garbage collect knowing that the program is not depending on the memory location as it may have been in C.   By giving up the address of operator, the JVM has the wiggle room to implement the garbage collection.&lt;br /&gt;&lt;br /&gt;Abstractions are made based on the properties (aka "wiggle room") of the underlying concept.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-4277127478266329773?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/4277127478266329773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=4277127478266329773' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/4277127478266329773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/4277127478266329773'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2011/01/wiggle-room-to-exploit-alternate.html' title='Wiggle room to exploit alternate representations and implementations.'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-8807836443463738158</id><published>2011-01-15T17:17:00.000-08:00</published><updated>2011-01-15T17:20:30.593-08:00</updated><title type='text'>WOW! my Java code sample from 96</title><content type='html'>Found my code back in an Java &lt;a href="http://www.javaworld.com/javaworld/jw-03-1996/jw-03-cyberstruction.html?page=2"&gt;article&lt;/a&gt; on 03/01/96!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-8807836443463738158?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/8807836443463738158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=8807836443463738158' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/8807836443463738158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/8807836443463738158'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2011/01/wow-my-java-code-sample-from-96.html' title='WOW! my Java code sample from 96'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-7228981299568558087</id><published>2011-01-11T22:00:00.000-08:00</published><updated>2011-01-11T22:06:33.309-08:00</updated><title type='text'>Functional programming in hardware..</title><content type='html'>&lt;object width="480" height="385"&gt;&lt;param name="movie" value="http://www.youtube.com/v/kRTsk7SAKMs?fs=1&amp;amp;hl=en_US"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/kRTsk7SAKMs?fs=1&amp;amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On the tangible programming there is also the Conal Elliot &lt;a href="http://www.youtube.com/watch?v=faJ8N0giqzw"&gt;talk&lt;/a&gt; that shows the same idea in Haskell&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-7228981299568558087?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/7228981299568558087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=7228981299568558087' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/7228981299568558087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/7228981299568558087'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2011/01/functional-programming-in-hardware.html' title='Functional programming in hardware..'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-2025649293697437566</id><published>2011-01-10T15:55:00.001-08:00</published><updated>2011-01-10T16:05:03.540-08:00</updated><title type='text'>Insight into continuation  and Haskell</title><content type='html'>A really nice introduction to &lt;a href="http://research.microsoft.com/apps/video/dl.aspx?id=103761"&gt;continuation&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The talk covers Scheme's implementation of Continuation.   What is interesting to note is that in language like Scheme, or Java to implement continuation you need hooks in the native language.    For instance, in this &lt;a href="http://http://www.artima.com/lejava/articles/continuations.html"&gt;interview&lt;/a&gt;  Bill Venners tries to explain the Java CM changes that are required to capture the continuation.    &lt;br /&gt;&lt;br /&gt;But if you look at Haskell version of continuation, you realize that there are no changes in the underlying language.  Continuation, just like Exception handling  is implemented as a library (&lt;a href="http://hackage.haskell.org/packages/archive/mtl/2.0.1.0/doc/html/Control-Monad-Cont.html"&gt;Control.Monad.Control.ContT&lt;/a&gt;).  Even delimited continuation can be done as a library: &lt;a href="http://www.haskell.org/haskellwiki/MonadCont_done_right"&gt;MonadCont&lt;/a&gt; or &lt;a href="http://www.haskell.org/haskellwiki/Library/CC-delcont"&gt;CC-delcont&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-2025649293697437566?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/2025649293697437566/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=2025649293697437566' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/2025649293697437566'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/2025649293697437566'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2011/01/insight-into-continuation-and-haskell.html' title='Insight into continuation  and Haskell'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-9065375980192267832</id><published>2011-01-06T13:48:00.000-08:00</published><updated>2011-01-06T14:19:29.829-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='*'/><title type='text'>Nice talk....</title><content type='html'>The  "Monadologie: Professional Help for Type Anxiety" talk by Chris League does nice job explaining:&lt;br /&gt;&lt;br /&gt;* CPS and Delimited Continuation&lt;br /&gt;* Application of Continuation to Parsing &lt;br /&gt;* State monad application to the tree injection.  &lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://player.vimeo.com/video/13304075" width="400" height="225" frameborder="0"&gt;&lt;/iframe&gt;&lt;p&gt;&lt;a href="http://vimeo.com/13304075"&gt;Monadologie: Professional Help for Type Anxiety&lt;/a&gt; from &lt;a href="http://vimeo.com/n8han"&gt;Nathan Hamblen&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-9065375980192267832?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/9065375980192267832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=9065375980192267832' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/9065375980192267832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/9065375980192267832'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2011/01/nice-talk-on-continuation.html' title='Nice talk....'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-8247985040869601337</id><published>2010-10-22T10:41:00.000-07:00</published><updated>2010-10-22T10:44:27.166-07:00</updated><title type='text'>Two very interesting lectures on Functional Logic Programming</title><content type='html'>&lt;object width="480" height="385"&gt;&lt;param name="movie" value="http://www.youtube.com/v/n2Wz9oKpZjs?fs=1&amp;amp;hl=en_US"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/n2Wz9oKpZjs?fs=1&amp;amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;object width="480" height="385"&gt;&lt;param name="movie" value="http://www.youtube.com/v/-xUrzNnhB9Q?fs=1&amp;amp;hl=en_US"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/-xUrzNnhB9Q?fs=1&amp;amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-8247985040869601337?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/8247985040869601337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=8247985040869601337' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/8247985040869601337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/8247985040869601337'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2010/10/two-very-interesting-lectures-on.html' title='Two very interesting lectures on Functional Logic Programming'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-3253711889673911088</id><published>2010-07-12T15:47:00.001-07:00</published><updated>2010-07-12T16:01:14.721-07:00</updated><title type='text'>Amazing discussion in 1966!</title><content type='html'>At the end of the Peter Ladin's "&lt;a href="http://www.thecorememory.com/Next_700.pdf"&gt;The next 700 programming languages&lt;/a&gt;" There is a very interesting discussion between giants  (&lt;a href="http://en.wikipedia.org/wiki/Christopher_Strachey"&gt;Strachey&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Peter_Landin"&gt;Landin&lt;/a&gt;, Smith, Young, and Abrahams)  of the software engineering.  A definite must read...&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Strachey: I should like to intervene now and try to initiate a slightly more general discussion on declarative or descriptive languages and to try to clear up some points about which there is considerable confusion. I have called the objects I am trying to discuss DLs because I don't quite know what they are. Here are some questions concerning ])Ls: (1) What are DLs? (2) What is their relationship to imperative languages? (3) Why do we need DLs? (4) How can we use them to program? (5) How can we implement them? (6) How can we do this efficiently? (7) Should we mix l)Ls with imperative languages?&lt;br /&gt;&lt;br /&gt;It seems to me that what I mean by DLs is not exactly what other people mean. I mean, roughly, languages which do not contain assignment statements or jumps. This is, as a matter of fact, not a very clear distinction because you can always disguise the assignments and the jumps, for that matter, inside other statement forms which make them look different. The important characteristic of DLs is that it is possible to produce equivalence relations, particularly the rule for substitution which Peter Landin describes as (~) in his paper. That equivalence relation, which appears to be essential in alost every proof, does not hold if you allow assignment statements. The great advantage then of l)Ls is that they give you some hope of proving the equivalence of program transformations and to begin to have a calculus for combining and manipulating them, which at the moment we haven't got.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I suggest that an answer to the second question is that DLs form a subset of all languages. They are an interesting subset, but one which is inconvenient to use unless you are used to it. We need them because at the moment we don't know how to construct proofs with languages which include imperatives and jumps.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;How should we use them to program? I think this is a matter of learning a new programming technique. I am not convinced that all problems are amenable to programming in DLs but I am not convinced that there are any which are not either; I preserve an open mind on this point. It is perfectly true that in the process of rewriting programs to avoid labels and jumps, you've gone half  the way towards going into 1)Ls. When you have also avoided assignment statements, you've gone the rest of the way. With many problems yeu can, in fact, go the whole way. LisP has no assignment statements and it is remarkable what you can do with pure Lisp if you try. If you think of it in terms of the implementations that we know about, the result is generally intolerably inefficient--but then that is where we come to the later questions.&lt;br /&gt;&lt;br /&gt;How do we implement them? There have not been many attempts to implement DLs efficiently, I think. Obviously, it can be done fairly straightforwardly by an interpretive method, but this is very slow. Methods which compile a runable program run into a lot of very interesting problems. It can be done, because DLs are a subset of ordinary programming languages; any programming language which has sufficient capabilities can cope with them. There are problems, however: we need entities whose value is a function--not the application of a function but a function--and these involve some problems.&lt;br /&gt;&lt;br /&gt;How to implement efficiently is another very interesting and difficult problem. It means, I think, recognizing certain subsets and transforming them from, say, recursions into loops. This can certainly be done even if they have been written iu terms of recursions and not, as Peter Landin suggested, in terms of already transformed functions like iterate or while.&lt;br /&gt;&lt;br /&gt;I think the last question, "Should DLs be nIixed with imperative languages?", clearly has the answer that they should, because at the moment we don't know how to do everything in pure DLs. If you mix declarative and imperative features like this, you may get an apparently large programming language, but the important thing is that it should be simple and easy to define a function. Any language which by mere chance of the way it is written makes it extremely difficult to write compositions of functions and very easy to write sequences of commands will, of course, in an obvious psychological way, hinder people from using descriptive rather than imperative features. In the long run, I think the effect will delay our understanding of basic similarities, which underlie different sorts of programs and different ways of solving problems.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Smith: As I understand the declarative languages, there has to be a mixture of imperative and descriptive statements or no computation will take place. If I give you a set of simultaneous equations, you may say "yes?", meaning well, what am I supposed to do about it, or you may say "yes", meaning yes I understand, but you don't do anything until I say "now find the values of the variables." In fact, in a well-developed language there is not just one question that I can ask but a number of questions. So, in effect, the declarative statements are like data which you set aside to be used later after I give you the imperatives, of which I had a choice, which get the action.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Strachey: This is a major point of confusion. There are two ideas here and I think we should try to sort them out. If you give a quadratic equation to a machine and then say "print the value of x", this is not the sort of language that I call a DL. I regard it as an implicit language--that is, one where you give the machine the data and then hope that it will be smart enough to solve the problem for you. It is very different from a language such as LisP, where you define a function explicitly and have only one imperative. which says "evaluate this expression and print the result."&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Abrahams: I've clone a fair amount of programming in LISP, and there is one situation which I feel is symptomatic of the times when you really do want an imperative language. It is a situation that arises if you are planning to do programming in pure Lisp and you find that your functions accumulate a large number of arguments. This often happens when you have a number of variables and you are actually going through a process and at each stage of the process you want to change the state of the world a little bit-- say, to change one of these variables. So you have the choice of either trying to communicate them all, or trying to do some sort of essentially imperative action that changes one of them. If you try to list all of the transitions from state to state and incorporate them into one function, you'll find that this is not really a very natural kind of function because the natures of the transitions are too different.&lt;br /&gt;&lt;br /&gt;Landin: I said in iny talk that LisP had not gone quite all the way and I think that this difficulty is connected with going all the way. If we write a function definition where the right-hand side is a listing of expressions such as&lt;br /&gt;&lt;br /&gt;F(x) = E1 , E2, E~&lt;br /&gt;&lt;br /&gt;thel~ we can say that this function will produce a three-list as its result. If llOW we have ~mother function G(x, y, z) = E, on some occasion we might have an expression such as G(a 2, b 2, c ~) and we often feel that we should be able to write G(F(t)), and another example which should be allowed is&lt;br /&gt;&lt;br /&gt;G(a &gt; b --~ E1 , E2 , E3 else E4 , E5 , E6).&lt;br /&gt;&lt;br /&gt;l am not quite sure but I think you can get around your problem by treating every function as if it were in fact monadic and had a single argument which was the list structure you are trying to process.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Abrahams: This is a difficulty in other programming languages too; you cannot define a function of an indefinite number of arguments.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Naur: I still don't understand this distinction about an implicit language. Does it mean that whenever you have such a language there is a built-in feature for solving equations?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Abrahams: I think the point is whether you are concerned with the problem or are concerned with the method of solution of the problem.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ingerman: I suggest that in the situation where you have specified everything that you want to know, though the exact sequence in which you evoke the various operations to cause the solution is left unspecified, then you have something which is effectively a descriptive language; if you have exactly the same pieces of information, surrounded with promises that you will do this and then this, then you have an imperative language. The significant point is that it is not all or nothing but there is a scale and while it is probably pretty simple to go all the way with imperatives, the chances of being ttble to get all the way descriptive is about zero, but there is a settle and we should recognize this scale. Smilh: I think that there is a confusion between implicit or explicit on the one hand and imperative or declarative on the other. These are two separate distinctions and can occur in all combinations. For illstance, an analog computer handles ilnplicit declaratives.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Young: I think it is fairly obvious that you've got to have the ability for sequencing imperatives in any sort of practical language. There are many, many cases in which only a certain sequence of operations will produce the logically correct results. So that we cannot have a purely declarative language, we must have a general purpose one. A possible definition of a declarative language is one in which I can make the statements (a), (b), (c) and (d) and indicate whether I mean these to be taken as a sequence or as a set; that is, must they be performed in a particular order or do I merely mean that so long as they are all performed, they may be performed in any sequence at any time and whenever convenient for efficiency.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Strachey: You can, in fact, impose an ordering on a language which doesn't have the sequencing of commands by nesting the functional applications.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Landin: The point is that when you compound functional expressions you are imposing a partial ordering, and when you decompose this into commands you are unnecessarily giving a lot of inforination about sequencing.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Strachey: One inconvenient thing about a purely imperative language is that you have to specify far too much sequencing. For example, if you wish to do a matrix multiplication, you have to do n a multiplications. If you write an ordinary program to do this, you have to specify the exact sequence which they are all to be done. Actually, it doesn't matter in what order you do the multiplications so long as you add them togcther in the right groups. Thus the ordinary sort of imperative language imposes much too much sequencing, which makes it very difficult to rearrange if you want to make things more efficient.&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-3253711889673911088?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/3253711889673911088/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=3253711889673911088' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3253711889673911088'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3253711889673911088'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2010/07/amazing-discussion-in-1966.html' title='Amazing discussion in 1966!'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-725085304547141263</id><published>2010-05-27T10:51:00.001-07:00</published><updated>2010-05-27T10:55:24.829-07:00</updated><title type='text'>Expression and Data</title><content type='html'>So functional programming is about &lt;span style="font-style:italic;"&gt;expressions&lt;/span&gt; instead of &lt;span style="font-style:italic;"&gt;statements&lt;/span&gt;.    As such it is interesting to note that expressions are also how you "express" your data model.  There was an interesting example of that in Haskell Cafe's mailing list:&lt;br /&gt;&lt;br /&gt;A question was asked as: "&lt;br /&gt;&lt;a href="http://groups.google.com/group/fa.haskell/browse_thread/thread/33f5a3c92ec87d51"&gt;Why Either = Left | Right instead of something like Result = Success | Failure&lt;/a&gt;"     This was interesting in the answers:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Either is a generic sum type. That is, "Either A B" only means "either you have an A, or you have a B". Use of Left to represent failure is merely a matter of convention. Similarly, the generic product type in Haskell is the 2-tuple--"(A, B)" only means "you have both an A and a B". &lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-725085304547141263?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/725085304547141263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=725085304547141263' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/725085304547141263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/725085304547141263'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2010/05/expression-and-data.html' title='Expression and Data'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-2459296466647818855</id><published>2010-05-11T22:56:00.000-07:00</published><updated>2010-05-11T23:37:45.593-07:00</updated><title type='text'>Monadic Web design in future of Cloud Computing?</title><content type='html'>In all discussions around cloud computing, at least to me, it seemsthat there are too much attention to low level detail and not enough on the bigger more abstract picture.&lt;br /&gt;&lt;br /&gt;I think this &lt;a href="http://vimeo.com/5318303"&gt;presentation&lt;/a&gt; describes an interesting alternative to the conventional thinking on what cloud computing will, or at least should be.  (&lt;br /&gt;&lt;br /&gt;Even though the presentation talks about search, there may be bigger point in the approach to the problem.  &lt;br /&gt;&lt;br /&gt;In the presentation the speaker shows that an application can be broken down into various well known notions.  I would think map/reduce would be one such notion.  But there are other notions such as non determinism, back tracking, .... that an application may be based on.&lt;br /&gt;&lt;br /&gt;In context of cloud, looking at it in abstract, if the underlying computational notions are cloud-aware/capable, or at least well understood as a cloud component,  then application written on them can easily run in a cloud just as simply it can run on a single machine.    The notions can be made to hide all the plumbing and make the application cloud agnostic.  The big change from the existing imperative programming is a re-evaluation of the application along functional model to separate the problem domain logic from the notions.  In the new model the application can be made to run in the cloud by only changing the underlying notions.   This is exactly what happened when people redid their application to run in the cloud as Map/Reduce.  But Map/Reduce can't be the only notion that can be made into a cloud.   To find other one needs to go back and study the notions of computation in more abstract terms and implement them as cloud.  The presentation shows examples of such an approach in context of sophisticated search queries.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-2459296466647818855?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/2459296466647818855/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=2459296466647818855' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/2459296466647818855'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/2459296466647818855'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2010/05/monadic-web-design-in-future-of-cloud.html' title='Monadic Web design in future of Cloud Computing?'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-2681849197260182630</id><published>2010-04-12T12:11:00.000-07:00</published><updated>2010-04-12T12:22:14.376-07:00</updated><title type='text'>Conceptual Tool</title><content type='html'>In Wikipedia Domain Specific Language is defined as:  &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;a programming language or specification&lt;br /&gt;language dedicated to a particular problem&lt;br /&gt;domain, a particular problem representation&lt;br /&gt;technique, and/or a particular solution technique&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I have been looking for a better "frame", I may have found one.&lt;br /&gt;&lt;br /&gt; I was  looking at &lt;a href="http://web.engr.oregonstate.edu/~erwig/papers/Hagl_JFP09.pdf"&gt;A domain-specific language for experimental&lt;br /&gt;game theory&lt;/a&gt; paper.  And this &lt;a href="http://www.economicsnetwork.ac.uk/archive/ou/tutorial_7/tutorial07.htm"&gt;Tutorial&lt;/a&gt; in game theory had a sentence that best captured the "DSL think" that I am looking for.   On 2nd slide it says:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;"To analyze strategic behavior we need the &lt;span style="font-weight:bold;"&gt;conceptual tool&lt;span style="font-style:italic;"&gt;&lt;/span&gt;&lt;/span&gt; of game theory..."&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;A DSL is essentially allows you to apply the conceptual tools to your domain.  The tools in turn need the underlying data in format that is also covered in your DSL.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-2681849197260182630?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/2681849197260182630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=2681849197260182630' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/2681849197260182630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/2681849197260182630'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2010/04/conceptual-tool.html' title='Conceptual Tool'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-7861100952492979932</id><published>2010-01-22T11:32:00.000-08:00</published><updated>2010-01-22T11:41:39.880-08:00</updated><title type='text'>Functional Programming Think...FP is a category!</title><content type='html'>In many of the articles/books on Category Theory the Category theory is explained in terms of mathematical concepts of Rings, Sets, Fields...  I have been struggling to see how it all relate to functional programming.   So this might be useful for others too...&lt;br /&gt;&lt;br /&gt;In section 2.2 this &lt;a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.103.172&amp;rep=rep1&amp;type=pdf"&gt;Category Theory lecture notes&lt;/a&gt;  there is an interesting explanation of explaning how functional programming forms a category.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-7861100952492979932?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/7861100952492979932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=7861100952492979932' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/7861100952492979932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/7861100952492979932'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2010/01/functional-programming-thinkfp-is.html' title='Functional Programming Think...FP is a category!'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-8846630809503367199</id><published>2010-01-22T10:40:00.000-08:00</published><updated>2010-01-22T11:21:19.181-08:00</updated><title type='text'>A metaphor for categories and mappings</title><content type='html'>I was trying to see if Design Pattern concepts (specially compositional patterns) have been explained in terms of functors, monads,....   I ran into this post about category theory that is enlightening...&lt;br /&gt;&lt;br /&gt;&lt;a href="http://lambda-the-ultimate.org/node/2604#comment-39235"&gt;A metaphor for categories and mappings&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This section in particular:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;For a really simple, real world example, consider a lawnmower. When out of gas/petrol, it needs to be refueled. The category of empty lawnmowers has an arrow/mapping/morphism to the category of full lawnmowers. Here the focus is more on the _process_ of mapping one category into another, or mapping one collection of things into another collection.&lt;br /&gt;&lt;br /&gt;It's been said that category theory places mappings/arrows on a fully-equal footing with objects/points/things.&lt;br /&gt;&lt;br /&gt;Now back to the lawnmower example. A child walks out to watch his father mowing the lawn. The lawmower runs out of gas. The child says "Daddy, I think the lawnmower needs a drink."&lt;br /&gt;&lt;br /&gt;What the child is doing is using his own set of mappings, from thirsty to not thirsty, to metaphorize the process of fueling the lawnmower. There's a mapping between these mappings, a functor. (&lt;span style="font-style:italic;"&gt;I happen to think this categorical way of thinking is immensely important for how we understand the world, how we might program artificial intelligences, and so on. Even more than "design patterns," I think we and other creatures chunk the world into pieces we can understand by finding the mappings and functors and so on which allow us to &lt;a href="http://en.wikipedia.org/wiki/Grok"&gt;grok&lt;/a&gt; the world. We are, I think, category theory engines.)&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Also this in the &lt;a href="http://lambda-the-ultimate.org/node/2604#comment-39421"&gt;comments&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;A more useful way to think about category theory compared to set theory is to view it as a kind of &lt;span style="font-style:italic;"&gt;inversion of reasoning&lt;/span&gt;. In set theory everything is built up, and we understand objects by seeing what they are made of -- picking apart their internals. We relate two objects by comparing what they are made of. Category theory turns that on its head and takes relationships between objects as primitive. From CT's point of view objects are opaque; we understand an object not by peeking inside at it's internal structure, as we would if we were using set theoretic thinking, but rather by examining how the object relates to other objects.&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-8846630809503367199?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/8846630809503367199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=8846630809503367199' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/8846630809503367199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/8846630809503367199'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2010/01/metaphor-for-categories-and-mappings.html' title='A metaphor for categories and mappings'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-893072272682797197</id><published>2010-01-20T16:46:00.000-08:00</published><updated>2010-01-20T17:00:25.549-08:00</updated><title type='text'>Functional Programming Think</title><content type='html'>It seems that as I am learning more Haskell, I find more nuggets in paper that I had read before.  For instance, John Hughes &lt;a href="http://www.cs.chalmers.se/~rjmh/Papers/arrows.pdf"&gt;Generalising Monads to Arrows&lt;/a&gt; paper has some very interesting insight into functional programming mind set.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;If this were an isolated case we might simply ignore it. But Swierstra and Duponcheel’s idea is clearly much more widely applicable: to optimise a combinator library, rede ne the combinators to collect static properties of the computations they construct, and then use those static properties to optimise the dynamic computations. If we think of a library as de ning a domain speci c ‘language’, whose constructions are represented as combinators, then Swierstra and Duponcheel’s idea is to implement the language via a combination of a static analysis and an optimised dynamic semantics. We may clearly wish to do this very often indeed. But every time we do, the type of &gt;&gt;= will make it impossible to use a monadic interface!&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And also on Category Theory&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-weight:bold;"&gt;3.1 On Category Theory&lt;/span&gt; &lt;br /&gt;Before we do so, we make a short digression on the subject of category theory. The concept of a monad was developed by category theorists long before it eventually found an application in functional programming. Some might find it surprising that something so abstract as category theory should turn out to be useful for something so concrete as programming. &lt;span style="font-weight:bold;"&gt;After all, category theory is, in a sense, so abstract as to be rather unsatisfying: it is ‘all definitions and no theorems’ &lt;/span&gt;, almost everything turns out to be a category if you look at it long enough, to say something is a category is actually to say very little about it. The same is true of most categorical concepts: they have very many possible instantiations, and so to say that something is, for example, a monad, is to say very little. &lt;span style="font-weight:bold;"&gt;This extreme generality is one reason why it is hard for the beginner to develop good intuitions about category theory,&lt;/span&gt; but it is hardly surprising: category theory was, after all, developed to be a ‘theory of everything’, a framework into which very many di erent mathematical structures would t. But why should a theory so abstract be of any use for programming? The answer is simple: as computer scientists, we value abstraction! When we design the interface to a software component, we want it to reveal as little as possible about the implementation [think algebra vs calculus]. We want to be able to replace the implementation with many alternatives, many other ‘instances’ of the same ‘concept’. When we design a generic interface to many program libraries, it is even more important that the interface we choose have a wide variety of implementations. It is the very generality of the monad concept which we value so highly, it is because category theory is so abstract that its concepts are so useful for programming.&lt;br /&gt;It is hardly surprising, then, that the generalisation of monads that we present below also has a close connection to category theory. But we stress that our purpose is very practical: it is not to ‘implement category theory’, &lt;span style="font weight:bold;"&gt;it is to find a more general way to structure combinator libraries &lt;/span&gt; It is simply our good fortune that mathematicians have already done much of the work for us.&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-893072272682797197?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/893072272682797197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=893072272682797197' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/893072272682797197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/893072272682797197'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2010/01/functional-programming-think.html' title='Functional Programming Think'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-1396160327877778238</id><published>2010-01-13T18:13:00.001-08:00</published><updated>2010-01-13T18:18:01.135-08:00</updated><title type='text'>Class types as "convenience functions"</title><content type='html'>I had hard time understanding the common practice in haskell of MonadXXX class relationship with XXX type (e.g. MonadReader  and Reader) until I run into this line:&lt;br /&gt;&lt;br /&gt;The MonadWriter class provides a number of convenience functions for working with Writer monads.  In the &lt;a href="http://www.haskell.org/all_about_monads/html/writermonad.html"&gt;Writer Monad tutorial&lt;/a&gt;.   &lt;br /&gt;&lt;br /&gt;Looking at the class interfaces as "convenience functions" to work with underlying type is interesting way of looking at it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-1396160327877778238?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/1396160327877778238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=1396160327877778238' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/1396160327877778238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/1396160327877778238'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2010/01/class-types-as-convenience-functions.html' title='Class types as &quot;convenience functions&quot;'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-3766718489692521135</id><published>2010-01-10T11:23:00.000-08:00</published><updated>2010-01-10T11:24:24.354-08:00</updated><title type='text'>What does Semnatic Design mean?</title><content type='html'>An excellent post on concept of &lt;a href="http://lukepalmer.wordpress.com/2008/07/18/semantic-design/"&gt;Semantic Design&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-3766718489692521135?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/3766718489692521135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=3766718489692521135' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3766718489692521135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3766718489692521135'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2010/01/what-does-semnatic-design-mean.html' title='What does Semnatic Design mean?'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-8815979310442860286</id><published>2009-12-29T15:07:00.000-08:00</published><updated>2009-12-29T15:08:16.920-08:00</updated><title type='text'>Advanced Functional Programming, Lecture Notes</title><content type='html'>&lt;a href="http://web.cecs.pdx.edu/~sheard/course/AdvancedFP/notes/index.html"&gt;CSE581 - Advanced Functional Programming, Lecture Notes&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-8815979310442860286?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/8815979310442860286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=8815979310442860286' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/8815979310442860286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/8815979310442860286'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2009/12/advanced-functional-programming-lecture.html' title='Advanced Functional Programming, Lecture Notes'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-85261970653404684</id><published>2009-12-29T12:43:00.000-08:00</published><updated>2009-12-29T12:44:10.762-08:00</updated><title type='text'>What is is that makes camp and darcs unique, and worth us spending time on</title><content type='html'>&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/iOGmwA5yBn0&amp;hl=en_US&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/iOGmwA5yBn0&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-85261970653404684?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/85261970653404684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=85261970653404684' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/85261970653404684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/85261970653404684'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2009/12/what-is-is-that-makes-camp-and-darcs.html' title='What is is that makes camp and darcs unique, and worth us spending time on'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-7319983170077645819</id><published>2009-09-18T17:49:00.000-07:00</published><updated>2009-09-18T17:51:51.078-07:00</updated><title type='text'>The best description of Functional Programming</title><content type='html'>The posting for PhD student position in Ultrech University in Holland seem to have the  best description of functional programming I have seen:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Lambda-calculus and term rewriting are models of computation lying at the basis of functional programming languages. Both possess syntactic meta-theories based on analyzing rewrite steps.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.nabble.com/Ph.D-position,-Utrecht-University,-the-Netherlands-td25348561.html"&gt;Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-7319983170077645819?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/7319983170077645819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=7319983170077645819' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/7319983170077645819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/7319983170077645819'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2009/09/best-description-of-functional.html' title='The best description of Functional Programming'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-8526008492830048140</id><published>2009-03-09T14:24:00.001-07:00</published><updated>2009-03-11T11:52:35.865-07:00</updated><title type='text'>It is all about composition....</title><content type='html'>Here is an interesting talk about the power of composition applied to UI world: &lt;br /&gt;&lt;a href="http://conal.net/blog/posts/tangible-functional-programming-a-modern-marriage-of-usability-and-composability/"&gt;Tangible Functional Programming: a modern marriage of usability and composability&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Update:  Conal's blog has been moved, I updated the link to the new address.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-8526008492830048140?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/8526008492830048140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=8526008492830048140' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/8526008492830048140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/8526008492830048140'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2009/03/it-is-all-about-composition.html' title='It is all about composition....'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-8222831274416565797</id><published>2009-03-06T22:38:00.000-08:00</published><updated>2009-03-06T23:00:34.926-08:00</updated><title type='text'>Java -&gt; Erlang core + Haskell types</title><content type='html'>From Joe Armstrong, creator of Erlang...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_oZJxQqsdtUs/SbIXh9X1z7I/AAAAAAAAEjM/LfhDzLw5Dbo/s1600-h/armstrong.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 254px;" src="http://1.bp.blogspot.com/_oZJxQqsdtUs/SbIXh9X1z7I/AAAAAAAAEjM/LfhDzLw5Dbo/s320/armstrong.jpg" alt="" id="BLOGGER_PHOTO_ID_5310332782800916402" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/erikstarck/468618010/in/photostream/"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;An interesting interview with &lt;a href="http://www.infoq.com/interviews/Erlang-Joe-Armstrong"&gt;Joe Armstrong&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-8222831274416565797?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/8222831274416565797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=8222831274416565797' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/8222831274416565797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/8222831274416565797'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2009/03/java-erlang-core-haskell-types.html' title='Java -&gt; Erlang core + Haskell types'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_oZJxQqsdtUs/SbIXh9X1z7I/AAAAAAAAEjM/LfhDzLw5Dbo/s72-c/armstrong.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-3452153330557626166</id><published>2009-02-09T16:27:00.000-08:00</published><updated>2009-02-09T20:56:24.360-08:00</updated><title type='text'>Your design depends on the glue you have...</title><content type='html'>The &lt;a href="http://en.wikipedia.org/wiki/Post-it_note"&gt;Post-it notes&lt;/a&gt; is an interesting case where a glue type created a whole set of products and even programming  &lt;a href="http://vimeo.com/2007411"&gt;tutorial&lt;/a&gt;!!!   &lt;br /&gt;&lt;br /&gt;In paper &lt;a href="http://www.cs.chalmers.se/~rjmh/Papers/whyfp.html"&gt;Why Functional Programming Matters&lt;/a&gt;, John Huges, has interesting observations:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;It is now generally accepted that modular design is the key to successful programming, .... However, there is a very important point that is often missed. When writing a modular program to solve a problem, one first divides the problem into subproblems, then solves the sub-problems and combines the solutions. &lt;span style="font-weight:bold;"&gt;The ways in which one can divide up the original problem depend directly on the ways in which one can glue solutions together. Therefore, to increase ones ability to modularise a problem conceptually, one must provide new kinds of glue in the programming language.&lt;span style="font-style:italic;"&gt;&lt;/span&gt;&lt;/span&gt; Complicated scope rules and provision for separate compilation only help with clerical details; they offer no new conceptual tools decomposing problems. &lt;br /&gt;&lt;br /&gt;One can appreciate the importance of glue by an analogy with carpentry. A chair can be made quite easily by making the parts - seat, legs, back etc. - and sticking them together in the right way. But this depends on an ability to make joints and wood glue. Lacking that ability, the only way to make a chair is to carve it in one piece out of a solid block of wood, a much harder task. This example demonstrates both the enormous power of modularisation and the importance of having the right glue.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;He says:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;To assist modular programming, a language must provide good glue. Functional programming languages provide two new kinds of glue - &lt;a href="http://en.wikipedia.org/wiki/Higher-order_function"&gt;higher-order functions&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Lazy_evaluation"&gt;lazy evaluation&lt;/a&gt;.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On higher-order functions he says:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;.....functional languages allow functions which are indivisible in conventional programming languages to be expressed as a combination of parts - a general higher order function and some particular specialising functions. Once defined, such higher order functions allow many operations to be programmed very easily. Whenever a new datatype is defined higher order functions should be written for processing it. This makes manipulating the datatype easy, and also localises knowledge about the details of its representation. The best analogy with conventional programming is with extensible languages  &lt;span style="font-weight:bold;"&gt; - it is as though the programming language can be extended with new control structures whenever desired&lt;/span&gt;.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On Lazy evaluation he says:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;The other new kind of glue that functional languages provide enables whole programs to be glued together. Recall that a complete functional program is just a function from its input to its output. If f and g are such programs, then (g . f ) is a program which, when applied to its input, computes &lt;br /&gt;&lt;br /&gt;g (f input) &lt;br /&gt;&lt;br /&gt;The program f computes its output which is used as the input to program g. This might be implemented conventionally by storing the output from f in a temporary file. The problem with this is that the temporary file might occupy so much memory that it is impractical to glue the programs together in this way. Functional languages provide a solution to this problem. The two programs f and g are run together in strict synchronisation. F is only started once g tries to read some input, and only runs for long enough to deliver the output g is trying to read. Then f is suspended and g is run until it tries to read another input. As an added bonus, if g terminates without reading all of f ’s output then f is aborted. F can even be a non-terminating program, producing an infinite amount of output, since it will be terminated forcibly as soon as g is finished. This allows termination conditions to be separated from loop bodies - a powerful modularisation. &lt;br /&gt;&lt;br /&gt;Since this method of evaluation runs f as little as possible, it is called “lazy evaluation”. It makes it practical to modularise a program as a generator which constructs a large number of possible answers, and a selector which chooses the appropriate one. While some other systems allow programs to be run together in this manner, only functional languages use lazy evaluation uniformly for every function call, allowing any part of a program to be modularised in this way. Lazy evaluation is perhaps the most powerful tool for modularisation in the functional programmer’s repertoire.&lt;br /&gt; &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can read the whole paper: &lt;a href="http://www.cs.chalmers.se/~rjmh/Papers/whyfp.html"&gt;Why Functional Programming Matters&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-3452153330557626166?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/3452153330557626166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=3452153330557626166' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3452153330557626166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3452153330557626166'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2009/02/your-design-depends-on-glue-you-have.html' title='Your design depends on the glue you have...'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-3298101267734671407</id><published>2009-02-06T16:47:00.000-08:00</published><updated>2009-02-10T13:07:13.259-08:00</updated><title type='text'>pure, side effect, types, and Computation....</title><content type='html'>A friend (a &lt;a href="http://en.wikipedia.org/wiki/Purist"&gt;purist&lt;/a&gt; one!) was arguing that a &lt;a href="http://en.wikipedia.org/wiki/Purely_functional"&gt;purely functional&lt;/a&gt; programming paradigm is not useful in real life.  His point was that a pure functional language means no side effect. Without side effect there is not much a software can do.  Simon Peyton Jones, one of the gurus of the Haskell, had an interesting comment in that a computer program that has no side effect is essentially a heater!  As it generates heat and no real useful work.  &lt;br /&gt;&lt;br /&gt;So what is the disconnect?  It has to do with a type systems and the scope of your types (essentially what are you typing in your system?)&lt;br /&gt;    &lt;br /&gt;Lets start from Assembly programming.  In an assembly language program any instruction can read/write from/to any address in its space.   To understand the code (as in debugging it) you need to go line by line and make sure you understand the side effects in each instruction.  &lt;br /&gt;&lt;br /&gt;High-level languages improved on this.  For instance in a C program (or Java), you know the types of the input and output to/from your function (or method).  The key point to realize is that the type of input/output doesn't say anything as to  what the  method will  (or will not) cause when it is invoked.     For instance, if a method takes two integer and returns another integer (as in add), you don't know if the invocation of the method would create any side effects on the file system.   The best you can do is to look at the program's (or Class) include (or imports).  For instance a class that doesn't import the file system classes (directly or indirectly) then its methods would not have any side effects or dependency in the file system.   &lt;br /&gt;&lt;br /&gt;Then comes Dependency Injection to solve the problem in Object oriented model.  Dependency Injection allowed you to abstract out your object's external dependencies into an interface that would get injected at run time into the class..  It is an improvement on the base Object Oriented model.  But on a given method invocation,  you still didn't know what would happen.  At least there is nothing in the compiler that you can count on to ensure the dependencies.  So for example, a call to a method1 on a class can influence a subsequent call to method2 of the class.   You would not have any idea about such backdoor connections.    With good programing practices you can get by.  But when you are thinking about testing, reuse or sharing  of code this kind of issues always creep in.  &lt;br /&gt;&lt;br /&gt;Clearly some languages do away with types all together.  But here we are talking about cases where (for whatever reason)  you want to have a type system.   What is interesting is that in languages that do have type system, the types of the input and output is not enough to be able to make sense of the code (as in maintain it, share it,  or write unit tests for it, etc).&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;If  instead of typing the input/out you actually type the computation then you can get lot out of your typing system.    Take for instance the saying: life is not a destination, it is journey.  In C/Java/etc life is a destination.  All you care about is the type of the returned data.  In typing the computation it is all about the journey.   But how is that different?      &lt;br /&gt;&lt;br /&gt;Let say your kids are going on a summer trip with their school.   What is important to you?  Do you just care that they reach their destination or are you also concern about the type of activities that they would experience along the way?    For instance, you want to know if they serve alcohol in the trip or not.  If kids are going on the trip, then may be you want to find alternatives.  If adults are going for the spring break, well that may be the thing you are looking for.   &lt;br /&gt;&lt;br /&gt;The key is that you don't want to forbid or encourage alcohol consumption (side effects) just that you want to make sure the type of the  journey (the computation) matches your requirements as in destination AND journey.  You want to know all the effects and not just the return value.  After all, if you want a type system, why should you just stop at the return values?&lt;br /&gt;&lt;br /&gt;In  Haskell, the type of the function is not just the return value, it is the type of computation (journey).    That is the key concept.   Of course the type of the return value would also be included in the type of computation. Furthermore,  there are cleaver ways to take a computation and define as abstract type (similar to template programming C++ or Generics in Java) where the actual type  of the return value depends on the invocation of the computation (based on other parameters).  If there are any side effects it would also show up on your type system.  You have full disclosure,  or specification.   Modeling IO is an interesting example of using type system to fully define computations with side effect.   The &lt;a href="http://www.haskell.org/haskellwiki/IO_inside"&gt;IO Inside&lt;/a&gt; article might be a good start to get more details.&lt;br /&gt;&lt;br /&gt;To sum it up, in a pure functional language you don't want to avoid side effects.  You just want to know the computational models that do generate side effect and use them accordingly.  The  beauty of it is that the compiler  ensures that a computation would not violate its computational contract.   &lt;br /&gt;&lt;br /&gt;Knowing the computation's type (as oppose to just its return value) is quite beneficial.  It like  the dependency injected but at function level.   Hence, the type signature can be used to perform automatic testing of the functions.   Furthermore, the caller can control the various aspect of the computation.    For instance, lets say the computation signature indicates that the computation generates log messages.  The caller can call the function with its own logging implementation in the computation, which sounds awfully like Aspects programming.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-3298101267734671407?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/3298101267734671407/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=3298101267734671407' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3298101267734671407'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3298101267734671407'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2009/02/pure-side-effect-types-and-computation.html' title='pure, side effect, types, and Computation....'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-7783667978660593768</id><published>2008-11-25T10:57:00.000-08:00</published><updated>2008-11-25T10:58:13.866-08:00</updated><title type='text'>Names vs Meaning</title><content type='html'>&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/0XgmrMZ0h54&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/0XgmrMZ0h54&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-7783667978660593768?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/7783667978660593768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=7783667978660593768' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/7783667978660593768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/7783667978660593768'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2008/11/names-vs-meaning.html' title='Names vs Meaning'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-4122192803977210611</id><published>2008-09-10T14:40:00.000-07:00</published><updated>2008-09-10T15:26:04.731-07:00</updated><title type='text'>Make friends with Visitors</title><content type='html'>A good starting point in understanding functional programming is to understand the difference between &lt;a href="http://en.wikipedia.org/wiki/Visitor_pattern"&gt;Visitor&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Strategy_Pattern"&gt;Strategy&lt;/a&gt; patterns.  Strategy pattern is what almost all OO programmers  are familiar with.  You have your graphic objects with their draw methods that faithfully draw the object.  From outside the caller has no idea about the underlying implementation.   In this model it is easy to add new objects to the system.  You can add new shapes, just as long as they implement draw method.    The pattern has a weakness in the sense that if you want to add a  new function then it would be difficult.  Let say we need to add a method to calculate the area of a shape, now every object has to be modified to implement the new method.    So you in Strategy pattern you are fixing your class interface but let your data be extensible.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Visitor pattern is also an OO pattern but most programmers are not as familiar with it.      The pattern is interesting in the sense that unlike the strategy pattern you fix your classes (say only deal with certain shapes) but let actions be extensible.  In visitor pattern to add a new requirement like calculating perimeter would be easy but adding a new shape would be difficult.   Assigning a new shape will require change to all the existing actions.  The most successful visitor pattern implementation are when you work with a specification where your data is defined but your actions are extensible.  Say for instance  you want to parse XML tree.  The specification of the tree structure is defined but what the application does with the tree is left for the application.    &lt;br /&gt;&lt;br /&gt;You may think to yourself that if I fix my data types then I would not easily be able to extend my system.  The key is that your data type should not just include primitive types.  It would need to include primitives to modify and compose basic primitives into more complex structure (like tree).  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://gigamonkeys.com/book/"&gt;Peter Seibel&lt;/a&gt; does a great job discussing the visitor pattern and its implementation in Java vs Lisp.   The ideas presented in the video is not lisp specific, but rather a different way of thinking about a problem.  Video of his presentation is available &lt;a href="http://video.google.com/videoplay?docid=448441135356213813"&gt;online&lt;/a&gt;.  Kudos to  Peter for his no-power-point presentation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-4122192803977210611?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/4122192803977210611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=4122192803977210611' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/4122192803977210611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/4122192803977210611'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2008/09/make-friends-with-visitors.html' title='Make friends with Visitors'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-3335863373977689413</id><published>2008-09-05T14:26:00.000-07:00</published><updated>2008-09-05T14:33:19.812-07:00</updated><title type='text'>What do you measure...</title><content type='html'>In questing Gross Domestic Product(GDP) measurements as valid health economic indicator, Martin Collier  of the Glaser Progress Foundation says:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;The most simple way to put it is you are what you measure, you get what you measure, and you fix what you measure. It's time to measure what matters most, it's time to measure what we value most, instead of simply valuing what we measure. &lt;a href="http://therealnews.com/t/index.php?option=com_content&amp;task=view&amp;id=31&amp;Itemid=74&amp;jumival=1172"&gt;Source&lt;/a&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Interesting...You {are, get, fix} what you measure.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-3335863373977689413?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/3335863373977689413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=3335863373977689413' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3335863373977689413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3335863373977689413'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2008/09/what-do-you-measure.html' title='What do you measure...'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-7851389809863130164</id><published>2008-09-04T11:58:00.000-07:00</published><updated>2008-09-04T13:22:17.832-07:00</updated><title type='text'>How little software has changed...</title><content type='html'>It is amazing how much of Computer Science was done way before it became as popular as it is today.  It is also amazing how  little it has progressed (at least as is practiced by professionals)  since the old days.  Back in August of 1978 &lt;a href="http://en.wikipedia.org/wiki/John_Backus"&gt;John Backus&lt;/a&gt; (The B in BNF and inventor of FORTRAN) had this to say:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Programming languages appear to be in trouble. Each successive language incorporates, with a little cleaning up, all the features of its predecessors plus a few more. Some languages have manuals exceeding 500 pages; others cram a complex description into shorter manuals by using dense formalisms. The Department of Defense has current plans for a committee-designed language standard that could require a manual as long as 1,000 pages. Each new language claims new and fashionable features, such as strong typing or structured control statements, but the plain fact is that few languages make programming sufficiently cheaper or more reliable to justify the cost of producing and learning to use them. &lt;br /&gt;&lt;br /&gt;Since large increases in size bring only small increases in power, smaller, more elegant languages such as Pascal continue to be popular. But there is a desperate need for a powerful methodology to help us think about programs and no conventional language even begins to meet that need. In fact, conventional languages create &lt;br /&gt;unnecessary confusion in the way we think about programs. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For twenty years programming languages have been steadily progressing toward their present condition of obesity; as a result, the study and invention of programming languages has lost much of its excitement. Instead, it is now the province of those who prefer to work with thick compendia of details rather than wrestle with new &lt;br /&gt;ideas. Discussions about programming languages often resemble medieval debates about the number of angels that can dance on the head of a pin instead of exciting &lt;br /&gt;contests between fundamentally differing concepts. &lt;br /&gt;&lt;br /&gt;Many creative computer scientists have retreated from inventing languages to inventing tools for describing them. Unfortunately, they have been largely content to apply their elegant new tools to studying the warts and moles of existing languages. After examining the appalling type structure of conventional languages, using the elegant tools developed by Dana Scott, it is surprising that so many of us remain passively content with that structure instead of energetically searching for new ones.&lt;br /&gt;&lt;br /&gt;Source: 1977 Turing Award Lecture: &lt;a href="http://www.stanford.edu/class/cs242/readings/backus.pdf"&gt;Can Programming Be Liberated From the von Neumann Style?&lt;/a&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Things seem to have got even worst.  C++ had so much issues (aka tricky interview questions) that someone needed to write  "&lt;a href="http://www.amazon.com/Effective-Specific-Addison-Wesley-Professional-Computing/dp/0201924889"&gt;Effective C++: 50 Specific Ways to Improve Your Programs and Design&lt;/a&gt;", and as if that was not bad enough, he had to do the follow on book: "&lt;a href="http://www.amazon.com/More-Effective-Addison-Wesley-Professional-Computing/dp/020163371X/ref=pd_sim_b_1"&gt;More Effective C++: 35 New Ways to Improve Your Programs and Designs&lt;/a&gt;".  Notice it is not talking about effective design, just how to get C++ to work for you, or how to avoid the "gotchas" in the language.   For me that was bad enough, so like many others I jumped to the next "successive language" which incorporated "with a little cleaning up, all the features of its predecessors plus a few more".  Just look at the size of &lt;a href="http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html"&gt;Java Generic FAQ &lt;/a&gt;.  Just this one language feature is worst than what John Backus was worried for the whole language: "Some languages have manuals exceeding 500 pages".  Here you have a language that the FAQ for just one of its feature is beyond comprehension.  &lt;br /&gt;&lt;br /&gt;Something is clearly wrong!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-7851389809863130164?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/7851389809863130164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=7851389809863130164' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/7851389809863130164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/7851389809863130164'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2008/09/it-is-amazing-how-much-of-computer.html' title='How little software has changed...'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-3693259535835068319</id><published>2008-09-04T11:25:00.000-07:00</published><updated>2008-09-04T11:38:55.414-07:00</updated><title type='text'>What is Computer Science?</title><content type='html'>Slides for MIT's course on "Structure and Interpretation of Computer Programs" is available &lt;a href="http://ocw.mit.edu/NR/rdonlyres/Electrical-Engineering-and-Computer-Science/6-001Spring-2005/0CB1005D-F6B4-4565-BF7F-FC9060C9C1B3/0/lecture1webhand.pdf"&gt;on line&lt;/a&gt;.   The first few slides talk about a key issue that I think is important in understanding the Computer Science and Software in general: &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;This first thing we need to do is discuss the focus of 6.001. What is this course all about? This seems quite obvious -- this is a course about computer science. But we are going to claim in a rather strange way that this is not really true. &lt;br /&gt; &lt;br /&gt;First of all, it is not really about science. It is really much more about engineering or art than it is about science. &lt;br /&gt;&lt;br /&gt;...and it is not really about computers. Now that definitely sounds strange! But let me tell you why I claim it is not really about computers. I claim it is not really about computers in the same way that physics is not really just about particle &lt;br /&gt;accelerators, or biology is not really just about microscopes, or geometry is not really about surveying instruments. &lt;br /&gt;&lt;br /&gt;In fact, geometry is a good analogy to use here. It has also a terrible name, which comes from two words: GHIA or earth, and METRA or measurement. And to the ancient Egyptians, that is exactly what geometry was -- instruments for measuring the earth, or surveying. Thousands of years ago, the Nile annually flooded, and eventually retreated, wiping out most of the identifying landmarks. It also deposited rich soil in its wake, making the land that it flooded very valuable, but also very hard to keep track of. As a consequence, the Egyptian priesthood had to arbitrate the restoration of land boundaries after the annual flooding. Since there were no landmarks, they needed a better way of determining boundaries, and they invented geometry, or earth  measuring. Hence, to the Egyptians, geometry was surveying -- and about surveying instruments. This is a common effect. When a field is just getting started, it’s easy to confuse the essence of the field with its tools, because we usually understand the tools much less well in the infancy of an area. In hindsight, we realize that the important essence of what the Egyptians did was to formalize the notions of space and time which later led to axiomatic methods for dealing with declarative, or What Is kinds of knowledge. --- So geometry not really about measuring devices, but rather about declarative knowledge. &lt;br /&gt; &lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;span style="font-weight:bold;"&gt;So geometry is not really about surveying, it is actually fundamentally about axioms for dealing with a particular kind of knowledge, known as Declarative, or "what is true" knowledge.&lt;/span&gt; &lt;/span&gt;&lt;br /&gt; &lt;br /&gt;By analogy to geometry, Computer Science is not really about computers -- it is not about the tool. It is actually about the kind of knowledge that computer science makes available to us. &lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-3693259535835068319?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/3693259535835068319/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=3693259535835068319' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3693259535835068319'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/3693259535835068319'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2008/09/what-is-computer-science.html' title='What is Computer Science?'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-2740528547613809221</id><published>2008-09-03T12:14:00.000-07:00</published><updated>2008-09-03T14:00:48.322-07:00</updated><title type='text'>"On X"</title><content type='html'>Paul Graham has interesting book called &lt;a href="http://www.paulgraham.com/onlisp.html"&gt;On Lisp&lt;/a&gt;.  If you are interested to know more about Lisp programming you can &lt;a href="http://www.paulgraham.com/onlisptext.html"&gt;download&lt;/a&gt; the book for free or read it on &lt;a href="http://www.bookshelf.jp/texi/onlisp/onlisp_toc.html#SEC_Contents"&gt;on line&lt;/a&gt;.   The point of this post is not so much to talk about the Lisp programming language as much as talking about why it is call "On Lisp".  Here is what author has to say about it:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Bottom-up design is becoming more important as software grows in complexity. Programs today may have to meet specifications which are extremely complex, or even open-ended. Under such circumstances, the traditional top-down method sometimes breaks down. In its place there has evolved a style of programming quite different from what is currently taught in most computer science courses: a bottom-up style in which a program is written as a series of layers, each one acting as a sort of programming language for the one above. X Windows and TeX are examples of programs written in this style.&lt;br /&gt;&lt;br /&gt;.....&lt;br /&gt;&lt;br /&gt;The title is intended to stress the importance of bottom-up programming in Lisp. Instead of just writing your program in Lisp, you can write your own language on Lisp, and write your program in that. &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;and,&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Bottom-up design leads naturally to extensible programs. The simplest bottom-up programs consist of two layers: language and program. Complex programs may be written as a series of layers, each one acting as a programming language for the one above. If this philosophy is carried all the way up to the topmost layer, that layer becomes a programming language for the user. Such a program, where extensibility permeates every level, is likely to make a much better programming language than a system which was written as a traditional black box, and then made extensible as an afterthought.&lt;/blockquote&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Keep "bottom-up" and more importantly "On XXX" concept in mind as you are trying to understand the functional programming paradigm.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-2740528547613809221?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/2740528547613809221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=2740528547613809221' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/2740528547613809221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/2740528547613809221'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2008/09/on-x-nugget.html' title='&quot;On X&quot;'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5623577383635787454.post-4568438199021887805</id><published>2008-09-01T21:10:00.000-07:00</published><updated>2008-09-01T21:35:08.421-07:00</updated><title type='text'>Haskell School of Expression</title><content type='html'>I am  long time imperative programmers (C/C++/Java) that feel I have reached a point where I need a paradigm shift.   I am looking more and more into functional programming and it seems to be what I need.   Unfortunetly it is painful to pick up the concept of functional programing.  There are bits and pieces of nuggets that I have been comming accross that may make the journey easier for new commers.  In this blog I intend to share my experience.&lt;br /&gt;&lt;br /&gt;A recurring issue in reading the Functional Programming papers is that the concepts are explained in terms of simple mathematical program.  For instance, you see volumes written on factorial, Fibonacci numbers, or simple programs.  They are all well and good, but  - at least for me - it is hard to map from factorial to a business problem I am trying to solve.  There are, however, nuggets that have been quite useful for me and I will do my best to share them.  Please let me know with your comments what does and doesn't work for you too.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The first must read in the topic of functional programming is the Pual Hudak's book: &lt;a href="http://books.google.com/books?id=lQbth9j5j9oC&amp;dq=haskell+school+of+expression&amp;pg=PP1&amp;ots=JPdn_9CYKB&amp;sig=LAHrhN_K-ga6b9KOAUdpIZ476gk&amp;hl=en&amp;sa=X&amp;oi=book_result&amp;resnum=1&amp;ct=result"&gt;The Haskell School of Expression&lt;/a&gt;&lt;br /&gt; You can read the book on line but I HIGHLY recommend that you get your own copy of the &lt;a href="http://www.haskell.org/soe/ordering.htm"&gt;book&lt;/a&gt;.  It is simply the best starting point on the topic.   &lt;br /&gt;&lt;br /&gt;From my perspective the best thing about the book is that it shows the functional programming implementation in terms of programs that a OO/Imperative programmers are already familiar with.     Almost every Object Oriented book describes the OO concept in a paint-like program.  Most people learn OO with geometrical shape objects and their draw methods.   Hudak's book implemented the same application in Haskell using Functional Programming concepts.   It is quite interesting to see how the FP uses the class and instance concept.  The book goes on to implement a &lt;a href="http://www.haskell.org/soe/images/foo0035.avi"&gt;Pong&lt;/a&gt; application in just 17 lines (see &lt;a href="http://www.haskell.org/soe/demos.htm"&gt;Demo4&lt;/a&gt; ).   The book is amazing, even if you are not interested in doing Functional Programming, I bet it would have a major impact in your designs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5623577383635787454-4568438199021887805?l=onfp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://onfp.blogspot.com/feeds/4568438199021887805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5623577383635787454&amp;postID=4568438199021887805' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/4568438199021887805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5623577383635787454/posts/default/4568438199021887805'/><link rel='alternate' type='text/html' href='http://onfp.blogspot.com/2008/09/haskell-school-of-expression.html' title='Haskell School of Expression'/><author><name>daryoush</name><uri>http://www.blogger.com/profile/05065493971847157320</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
