<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: On Lisp -&gt; Clojure (Chapter 4)</title>
	<atom:link href="http://blog.fogus.me/2008/10/08/on-lisp-clojure-chapter-4/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.fogus.me/2008/10/08/on-lisp-clojure-chapter-4/</link>
	<description>λ λ λ</description>
	<lastBuildDate>Sun, 29 Jan 2012 10:17:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Nevena</title>
		<link>http://blog.fogus.me/2008/10/08/on-lisp-clojure-chapter-4/comment-page-1/#comment-21949</link>
		<dc:creator>Nevena</dc:creator>
		<pubDate>Sat, 04 Dec 2010 00:09:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.earthvssoup.com/?p=946#comment-21949</guid>
		<description>&lt;p&gt;&lt;b&gt;flatten&lt;/b&gt; function won&#039;t work.
clojure.core 1.2 has the right one.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><b>flatten</b> function won&#8217;t work.
clojure.core 1.2 has the right one.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: fogus</title>
		<link>http://blog.fogus.me/2008/10/08/on-lisp-clojure-chapter-4/comment-page-1/#comment-9455</link>
		<dc:creator>fogus</dc:creator>
		<pubDate>Thu, 23 Jul 2009 18:36:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.earthvssoup.com/?p=946#comment-9455</guid>
		<description>&lt;p&gt;@Kunjan,&lt;/p&gt;

&lt;p&gt;One thing to be aware of with these posts -- they are hopelessly out of date.  My use of &lt;code&gt;lazy-cons&lt;/code&gt; is actually no longer legal Clojure code.  At the time of this writing it was the way to cons an element onto the head of a sequence in a lazy way.  By lazy I mean that the elements of the sequence are not calculated until accessed.  Clojure is now &lt;em&gt;mostly&lt;/em&gt; lazy and therefore it makes &lt;code&gt;lazy-cons&lt;/code&gt; unnecessary.  The more appropriate way to do this now is to use &lt;code&gt;lazy-seq&lt;/code&gt; like so:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(def foo (cons (do (println &quot;hi there&quot;) &#039;x) &#039;()))  ;; you will see &quot;hi there&quot; printed... non-lazy
foo   ;;  you will see (x)

(def foo (lazy-seq (cons (do (println &quot;fff&quot;) &#039;x) &#039;())))  ;; nothing is printed, until...
foo
;; now you will see &quot;hi there&quot; printed during the lookup of foo
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Hopefully, that clarifies matters.&lt;/p&gt;

&lt;p&gt;-m&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Kunjan,</p>

<p>One thing to be aware of with these posts &#8212; they are hopelessly out of date.  My use of <code>lazy-cons</code> is actually no longer legal Clojure code.  At the time of this writing it was the way to cons an element onto the head of a sequence in a lazy way.  By lazy I mean that the elements of the sequence are not calculated until accessed.  Clojure is now <em>mostly</em> lazy and therefore it makes <code>lazy-cons</code> unnecessary.  The more appropriate way to do this now is to use <code>lazy-seq</code> like so:</p>

<pre><code>(def foo (cons (do (println "hi there") 'x) '()))  ;; you will see "hi there" printed... non-lazy
foo   ;;  you will see (x)

(def foo (lazy-seq (cons (do (println "fff") 'x) '())))  ;; nothing is printed, until...
foo
;; now you will see "hi there" printed during the lookup of foo
</code></pre>

<p>Hopefully, that clarifies matters.</p>

<p>-m</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Kunjan</title>
		<link>http://blog.fogus.me/2008/10/08/on-lisp-clojure-chapter-4/comment-page-1/#comment-9437</link>
		<dc:creator>Kunjan</dc:creator>
		<pubDate>Thu, 23 Jul 2009 00:25:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.earthvssoup.com/?p=946#comment-9437</guid>
		<description>&lt;p&gt;Hi,
I am learning clojure. And your posts are very very helpful. Could you tell me why you use lazy to add to the list. I have seen a lot of lazy-cons and lazy-cat. What is the advantage of these?&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi,
I am learning clojure. And your posts are very very helpful. Could you tell me why you use lazy to add to the list. I have seen a lot of lazy-cons and lazy-cat. What is the advantage of these?</p>

<p>Thanks.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: David Siegel</title>
		<link>http://blog.fogus.me/2008/10/08/on-lisp-clojure-chapter-4/comment-page-1/#comment-279</link>
		<dc:creator>David Siegel</dc:creator>
		<pubDate>Sun, 14 Dec 2008 09:06:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.earthvssoup.com/?p=946#comment-279</guid>
		<description>&lt;p&gt;Shouldn&#039;t (most) be:&lt;/p&gt;

&lt;p&gt;(defn most [f xs]
  (let [x (reduce
       #(if (&gt; (f %1) (f %2))
          %1
          %2)
       xs)]
    [x (f x)]))&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Shouldn&#8217;t (most) be:</p>

<p>(defn most [f xs]
  (let [x (reduce
       #(if (&gt; (f %1) (f %2))
          %1
          %2)
       xs)]
    [x (f x)]))</p>]]></content:encoded>
	</item>
</channel>
</rss>

