<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Object Mentor Blog: Imposing the Edges Later</title>
    <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Imposing the Edges Later</title>
      <description>&lt;p&gt;Here&amp;#8217;s what wikipedia has to say about lazy evaluation: 

&lt;blockquote&gt;The benefits of lazy evaluation include: performance increases due to avoiding unnecessary calculations, avoiding error conditions in the evaluation of compound expressions, the ability to construct infinite data structures, and the ability to define control structures as regular functions rather than built-in primitives.&lt;/blockquote&gt;

&lt;p&gt;It&amp;#8217;s all true, but I think it misses a point.  One of the nicest things about lazy evaluation is that it enables a different form of abstraction.  Take a look at &lt;a href=http://www.physics.emory.edu/~weeks/software/mandel.c&gt;this code&lt;/a&gt;.  It computes the &lt;a href=http://en.wikipedia.org/wiki/Mandelbrot_set&gt;Mandelbrot Set.&lt;/a&gt;  There are many ways to code up this algorithm, but the code I just linked to is very typical &amp;#8211; it&amp;#8217;s a doubly nested loop which iterates over a specific rectangle in the complex plane.  It&amp;#8217;s hard to see anything that&amp;#8217;s awkward about its iteration strategy in a procedural language &amp;#8211; the algorithm does require starting and ending points in the plane.

&lt;p&gt;Let&amp;#8217;s look at a different way of approaching this.  Here&amp;#8217;s part of a Mandelbrot Set generator in Haskell:

&lt;code&gt;&lt;pre&gt;
mandelbrot :: Double -&amp;gt; [[Int]]
mandelbrot incrementSize =
  [[ escapeIterations $ translate offset . translate (x,y) . mandel
    | x &amp;lt;- increments]
    | y &amp;lt;- increments] 
   where increments = [0.0, incrementSize .. ]

window :: (Int, Int) -&amp;gt; (Int, Int) -&amp;gt; [[a]] -&amp;gt; [[a]]
window (x0, x1) (y0, y1) = range y0 y1 . map (range x0 x1)
  where range m n = take (n-m) . drop m

&lt;/pre&gt;&lt;/code&gt;

&lt;p&gt;The interesting bit is the &lt;code&gt;mandelbrot&lt;/code&gt; function.  It contains a doubly-nested list comprehension which, essentially, mimics the behavior of a doubly-nested loop in the procedural algorithm.  However, there is one interesting difference.  This list comprehension actually represents the mandelbrot computation across a full quarter of the infinite plane &amp;#8211; it goes from zero to infinity in x and y.  All we have to do is pass it an increment size and it is configured to create that grid. If we want to zoom in to a particular place in the Mandelbrot Set, we can use the &lt;code&gt;window&lt;/code&gt; function like this:

&lt;code&gt;&lt;pre&gt;
-- compute the mandelbrot from (10,10) inclusive to
-- (20,20) exclusive with an increment of 0.05 

window (10, 20) (10, 20) $ mandelbrot 0.05
&lt;/pre&gt;&lt;/code&gt;   

&lt;p&gt;The trick to this code is in &lt;code&gt;window&lt;/code&gt;&amp;#8217;s &lt;code&gt;range&lt;/code&gt; computation.  It takes a starting position, an ending position, and a list and it drops all of the elements of the list before the starting position, without evaluating them, and then it takes, from the front of the new list, &lt;code&gt;end - start&lt;/code&gt; elements, giving us a sub-range from the original list.  When that elements of that sub-list are evaluated, the computation for each point in the window occurs.    

&lt;p&gt;This code yields the computation that we want and the neat thing is, we are really only computing the piece we specified with &lt;code&gt;window&lt;/code&gt;.  We&amp;#8217;ve essentially formed a general computation and imposed the edges later.

&lt;p&gt;Looking back now at the imperative mandelbrot code, it&amp;#8217;s easy to see that it was, in a way, mixing two concerns.  The code which determined the range was mixed with the code which generated the set.  Laziness allows us to separate the two concerns.  

	&lt;p&gt;&lt;i&gt;Note: There are much more direct ways of computing the Mandelbrot Set in Haskell.  Here&amp;#8217;s one which is &lt;a href=http://warp.povusers.org/MandScripts/haskell.html&gt;particularly brief.&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sat, 08 Aug 2009 11:12:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:04c166b9-ce54-4fda-8121-7e8898845702</guid>
      <author>Michael Feathers</author>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later</link>
      <category>Michaels Musings</category>
    </item>
    <item>
      <title>"Imposing the Edges Later" by Microsoft Office</title>
      <description>&lt;p&gt;This article is GREAT it can be EXCELLENT JOB and what a great tool!&lt;/p&gt;</description>
      <pubDate>Fri, 13 Jan 2012 20:56:58 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:3255e1b4-2745-4658-a206-245471eded09</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-197766</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by Orya Jan</title>
      <description>&lt;p&gt;This code yields the computation that we want and the neat thing is, we are really only computing the piece we specified with window. We&#8217;ve essentially formed a general computation and imposed the edges later.&lt;/p&gt;</description>
      <pubDate>Sun, 08 Jan 2012 00:48:03 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:5ef76116-b50e-4ef9-920c-38125aace2da</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-195998</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by Backup iphone sms</title>
      <description>&lt;p&gt;It is true that you can&amp;#8217;t make sure when the iPhone crashed.
it is better to make a copy of the files on it.&lt;/p&gt;</description>
      <pubDate>Sat, 07 Jan 2012 06:11:22 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:953bb0e1-1ed4-42e3-b7a8-b81677daa9a5</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-195895</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by christian louboutin</title>
      <description>&lt;p&gt;The professional design make you foot more comfortable. Even more tantalizing,this pattern make your legs look as long as you can,it will make you looked more attractive.Moveover,it has reasonable price.If you are a popular woman,do not miss it.&lt;/p&gt;


	&lt;p&gt;Technical details of Christian Louboutin Velours Scrunch Suede Boots Coffee:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;Color: Coffee
Material: Suede
4(100mm) heel
Signature red sole x&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Fashion, delicate, luxurious Christian louboutins shoes on sale, one of its series is Christian Louboutin Tall Boots, is urbanism collocation. This Christian louboutins shoes design makes people new and refreshing. Red soles shoes is personality, your charm will be wonderful performance.&lt;/p&gt;</description>
      <pubDate>Thu, 03 Nov 2011 10:18:31 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:d79b1bb8-2cad-4067-8ada-80c1574d7d61</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-167659</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by ysbearing/yisong@1stbearing.com</title>
      <description>&lt;p&gt;Slewing bearing called slewing ring bearings, is a comprehensive load to bear a large bearing, can bear large axial, radial load and overturning moment. &lt;a href="http://www.1stbearing.com" rel="nofollow"&gt;http://www.1stbearing.com&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 19 Oct 2011 01:59:57 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:606cc505-0399-4f3a-920f-d23168be17d3</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-159356</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by Ashley Bowling</title>
      <description>&lt;p&gt;Forgive and forget
Fortune favours the brave
From the sublime to the ridiculous is only one step&lt;/p&gt;</description>
      <pubDate>Sat, 15 Oct 2011 15:38:48 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:63f84720-23d9-43dc-a2ac-83c8ce766b98</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-157206</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by Medical Coder Job Description</title>
      <description>&lt;p&gt;This is really enjoyed  &lt;a href="http://medicalcoderjobdescription.com/" rel="nofollow"&gt;Medical Coder Job Description&lt;/a&gt; for visiting the nice info in this blog and great technology in this blog &lt;a href="http://probationofficerjobdescription.com/" rel="nofollow"&gt;Probation Officer Job Description&lt;/a&gt;  and I had really like it very much for providing the great technology in this blog. This website is really admired for this info in this blog. I am very much satisfied by the info in this blog &lt;a href="http://personaltrainerjobdescription.org/" rel="nofollow"&gt;Personal Trainer Job Description&lt;/a&gt;  Thank you very much for providing the great technology in this blog. I was really like it &lt;a href="http://homehealthaidejobdescription.net/" rel="nofollow"&gt;Home Health aide Job Description&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 03 Oct 2011 07:08:27 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:49684b0d-e195-4e1d-b7a3-cd4db418c2aa</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-149508</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by african Mango dr oz</title>
      <description>&lt;p&gt;It is not hard to understand why the question of value is still raised when you consider that today?s outsourcing models have some inherent limitations that reduce the overall gains companies can achieve .&lt;/p&gt;</description>
      <pubDate>Tue, 27 Sep 2011 11:39:25 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:74b015fb-6b28-4f63-926e-a8e30499fe87</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-146147</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by beats by dre store</title>
      <description>&lt;p&gt;are always rare to find , at least with great quality,you qualify for a great blog post writer title,kep the great job happening&lt;a href="http://www.drdrebeatsheadphones-australia.com" rel="nofollow"&gt;high quality headphones&lt;/a&gt;
&lt;a href="http://www.drdrebeatsheadphones-australia.com" rel="nofollow"&gt;new design headphones&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 23 Aug 2011 03:22:32 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:ee9e0cea-6999-4995-b832-207589ea0cba</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-131680</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by what is provillus</title>
      <description>&lt;p&gt;Blog posts about wedding and bridal are always rare to find , at least with great quality,you qualify for a great blog post writer title,kep the great job happening&lt;/p&gt;</description>
      <pubDate>Thu, 28 Jul 2011 16:47:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:d9d46c36-cdd3-4013-82d1-2a58fc1dd41b</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-121442</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by Essay Help</title>
      <description>&lt;p&gt;I agree with information you  have provided but there are some points need to be clear. Can I ask here. I need some more details.&lt;/p&gt;</description>
      <pubDate>Mon, 30 May 2011 11:54:48 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:1f3d3987-5caa-4089-b1d9-6de5b9db31b9</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-105529</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by Easy Help</title>
      <description>&lt;p&gt;I agree with your description but there are some points need to be clarify. May I ask here. I need some more details. &lt;a &gt;Easy Help&lt;/a rel="nofollow"&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 26 May 2011 15:55:30 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:bbcdc1af-18f9-4f50-837d-2a1bdb27b2c0</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-103560</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by f350 leveling kit</title>
      <description>&lt;p&gt;I really love posting article here in website
Thank you :-)&lt;/p&gt;</description>
      <pubDate>Thu, 12 May 2011 16:27:29 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:11b7c57a-b9a4-4cc8-a8b0-c4a3cb54467a</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-98887</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by leveling kit f250</title>
      <description>&lt;p&gt;Your article is so useful and informative Thank you :-)&lt;/p&gt;</description>
      <pubDate>Thu, 12 May 2011 16:26:44 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:9753c451-6fc6-4549-9e17-fcdbb5279f01</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-98886</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by fleveling kit ford</title>
      <description>&lt;p&gt;Your article is so useful and informative Thank you :-)&lt;/p&gt;</description>
      <pubDate>Thu, 12 May 2011 16:26:26 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:d5e82f17-cf82-4715-a831-118cc2d7947b</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-98885</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by ford leveling kit</title>
      <description>&lt;p&gt;Your post is informative I really love it
Thank you :-)&lt;/p&gt;</description>
      <pubDate>Thu, 12 May 2011 16:25:46 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:672a8ea3-c3b2-46d6-950b-c6205a9ef043</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-98884</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by leveling kit f250</title>
      <description>&lt;p&gt;Thank you for your informative post&lt;/p&gt;</description>
      <pubDate>Thu, 12 May 2011 14:22:42 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:95483ecc-e2bb-4e3f-ab07-598b61dbb446</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-98851</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by ford leveling kit</title>
      <description>&lt;p&gt;Amazing , we all love it&lt;/p&gt;</description>
      <pubDate>Thu, 12 May 2011 14:20:53 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:2a3ab3a8-e465-40d7-bd5d-df6f6ec702bd</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-98849</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by Dissertation Help</title>
      <description>&lt;p&gt;Your site gives me much interesting stuff here, I really enjoyed. I will be back for more new updates here.&lt;/p&gt;</description>
      <pubDate>Mon, 09 May 2011 13:41:33 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:9832e080-b343-4b60-ae28-a480c08537cc</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-96939</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by okey oyunu oyna </title>
      <description>&lt;p&gt;Thanks.&lt;/p&gt;


	&lt;p&gt;internette g&#246;r&#252;nt&#252;l&#252; olarak &lt;a href="http://www.okeyoyunu-oyna.com" rel="nofollow"&gt;okey oyunu oyna&lt;/a&gt;, ger&#231;ek kisilerle tanis,
 turnuva heyecanini yasa.&lt;/p&gt;</description>
      <pubDate>Thu, 28 Apr 2011 15:10:06 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:242eb215-f8b2-4b26-b4da-0aaea3eabc83</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-92789</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by belstaffsaleonline.com </title>
      <description>&lt;p&gt;Belstaff Sale Trialmaster sequence is one of probably the most well liked coats&lt;/p&gt;</description>
      <pubDate>Mon, 25 Apr 2011 09:56:08 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:0545e7b9-2d00-43b1-ac6e-b999c1681777</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-90504</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by alan</title>
      <description>&lt;p&gt;That&amp;#8217;s good, I was just passing by and got it wonderful to read. Thank you. &lt;a href="http://www.allegromedical.com/wound-care-c541/wound-dressing-c3775.html" rel="nofollow"&gt;wound dressings&lt;/a&gt;, &lt;a href="http://www.allegromedical.com/wound-care-c541/tegaderm-hp-transparent-dressing-8-x-12-p191072.html" rel="nofollow"&gt;tegaderm&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 24 Apr 2011 05:58:55 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:e8c11d12-8666-403a-92d3-950bc02751ad</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-89902</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by belstaff</title>
      <description>&lt;p&gt;In order to meet all demands, producing &lt;a href="http://www.belstafflondon.com/" rel="nofollow"&gt;&lt;b&gt;belstaff jackets&lt;/b&gt;&lt;/a&gt;&lt;br&gt; never reduce. So many brands in the world conluding North Face jackets, &lt;a href="http://www.belstafflondon.com/belstaff-jackets/mens-belstaff-jackets.html/" rel="nofollow"&gt;&lt;b&gt;Mens Belstaff Jackets&lt;/b&gt;&lt;/a&gt;&lt;br&gt;    , columbia jackets and also spyder &lt;a href="http://www.belstafflondon.com/" rel="nofollow"&gt;&lt;b&gt;belstaff jacket&lt;/b&gt;&lt;/a&gt;&lt;br&gt;, each of them is high quality, workmanship, stylish and comfortable, add waterproof and durable freature, they also support for extreme sports.&lt;/p&gt;</description>
      <pubDate>Thu, 21 Apr 2011 19:38:57 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:46a76f46-30dc-499e-a681-d18fd1151038</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-88952</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by www.belstafflondon.com </title>
      <description>&lt;p&gt;&lt;a href="http://www.belstafflondon.com/" rel="nofollow"&gt;&lt;b&gt;belstaff&lt;/b&gt;&lt;/a&gt; Boots purchase for a lot of women on &lt;a href="http://www.belstafflondon.com/" rel="nofollow"&gt;&lt;b&gt;Belstaff UK Outlet&lt;/b&gt;&lt;/a&gt;&lt;br&gt;store online. it is possible to buy belstaff Trailmaster boots, belstaff junglemaster boots in reduction with completely free shipping. in spite of the fact that we don&amp;#8217;t have belstaff pants on our store, &lt;a href="http://www.belstafflondon.com/" rel="nofollow"&gt;&lt;b&gt;belstaff jackets&lt;/b&gt;&lt;/a&gt; also go with belstaff boots well.Made using the finest leather, these knee increased Belstaff Boots have undergone a precise ageing process which give them a timeless charm.&lt;/p&gt;</description>
      <pubDate>Thu, 14 Apr 2011 21:18:40 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:a74aa14e-61e5-4ecc-a3ee-c5aeebf9e554</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-85167</link>
    </item>
    <item>
      <title>"Imposing the Edges Later" by www.belstafflondon.com </title>
      <description>&lt;p&gt;&lt;a href="http://www.belstafflondon.com/" rel="nofollow"&gt;&lt;b&gt;belstaff&lt;/b&gt;&lt;/a&gt; Boots purchase for a lot of women on &lt;a href="http://www.belstafflondon.com/" rel="nofollow"&gt;&lt;b&gt;Belstaff UK Outlet&lt;/b&gt;&lt;/a&gt;&lt;br&gt;store online. it is possible to buy belstaff Trailmaster boots, belstaff junglemaster boots in reduction with completely free shipping. in spite of the fact that we don&amp;#8217;t have belstaff pants on our store, &lt;a href="http://www.belstafflondon.com/" rel="nofollow"&gt;&lt;b&gt;belstaff jackets&lt;/b&gt;&lt;/a&gt; also go with belstaff boots well.Made using the finest leather, these knee increased Belstaff Boots have undergone a precise ageing process which give them a timeless charm. &lt;a href="http://www.belstafflondon.com/belstaff-shoes-boots.html/" rel="nofollow"&gt;&lt;b&gt;Belstaff Boots&lt;/b&gt;&lt;/a&gt; are very rugged, sturdy, cool and very stylish.&lt;/p&gt;</description>
      <pubDate>Thu, 14 Apr 2011 21:18:06 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:b4cc4cab-6863-41d4-8f4c-ff705ff357d4</guid>
      <link>http://blog.objectmentor.com/articles/2009/08/08/imposing-the-edges-later#comment-85166</link>
    </item>
  </channel>
</rss>

