<?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 for Digital Digressions by Stuart Sierra</title>
	<atom:link href="http://stuartsierra.com/comments/feed" rel="self" type="application/rss+xml" />
	<link>http://stuartsierra.com</link>
	<description>From programming to everything else</description>
	<lastBuildDate>Sun, 20 May 2012 10:06:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>Comment on Syntactic Pipelines by Sergio Bossa</title>
		<link>http://stuartsierra.com/2012/05/16/syntactic-pipelines/comment-page-1#comment-44500</link>
		<dc:creator>Sergio Bossa</dc:creator>
		<pubDate>Sun, 20 May 2012 10:06:53 +0000</pubDate>
		<guid isPermaLink="false">http://stuartsierra.com/?p=624#comment-44500</guid>
		<description>Right, missed that: thanks for clarifying!</description>
		<content:encoded><![CDATA[<p>Right, missed that: thanks for clarifying!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Syntactic Pipelines by Stuart</title>
		<link>http://stuartsierra.com/2012/05/16/syntactic-pipelines/comment-page-1#comment-44495</link>
		<dc:creator>Stuart</dc:creator>
		<pubDate>Sat, 19 May 2012 19:29:15 +0000</pubDate>
		<guid isPermaLink="false">http://stuartsierra.com/?p=624#comment-44495</guid>
		<description>Sergio: You can already supply your own map-manipulation functions: that&#039;s why the &lt;code&gt;return&lt;/code&gt; macro has the original &lt;code&gt;body&lt;/code&gt; as the &quot;else&quot; clause in the &lt;code&gt;case&lt;/code&gt; expression: if the expression given to &lt;code&gt;return&lt;/code&gt; isn&#039;t one of the predefined keywords, it&#039;s just included verbatim.</description>
		<content:encoded><![CDATA[<p>Sergio: You can already supply your own map-manipulation functions: that&#8217;s why the <code>return</code> macro has the original <code>body</code> as the &#8220;else&#8221; clause in the <code>case</code> expression: if the expression given to <code>return</code> isn&#8217;t one of the predefined keywords, it&#8217;s just included verbatim.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Syntactic Pipelines by Sergio Bossa</title>
		<link>http://stuartsierra.com/2012/05/16/syntactic-pipelines/comment-page-1#comment-44494</link>
		<dc:creator>Sergio Bossa</dc:creator>
		<pubDate>Sat, 19 May 2012 19:19:44 +0000</pubDate>
		<guid isPermaLink="false">http://stuartsierra.com/?p=624#comment-44494</guid>
		<description>Very nice piece of work, look forward to see it on GitHub ;)

Just one improvement imho: I&#039;d personally prefer if users could provide their own map manipulation functions rather than just relying on predefined ones; what do you think?</description>
		<content:encoded><![CDATA[<p>Very nice piece of work, look forward to see it on GitHub ;)</p>
<p>Just one improvement imho: I&#8217;d personally prefer if users could provide their own map manipulation functions rather than just relying on predefined ones; what do you think?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Syntactic Pipelines by Stuart</title>
		<link>http://stuartsierra.com/2012/05/16/syntactic-pipelines/comment-page-1#comment-44493</link>
		<dc:creator>Stuart</dc:creator>
		<pubDate>Sat, 19 May 2012 18:16:06 +0000</pubDate>
		<guid isPermaLink="false">http://stuartsierra.com/?p=624#comment-44493</guid>
		<description>Dmitri: It&#039;s not an explicit return call (which Clojure does not support) I just chose the name &lt;code&gt;return&lt;/code&gt; because that&#039;s where you put the code that manipulates the return value of the function. As I said, the &lt;code&gt;return&lt;/code&gt; macro always has to be in tail position anyway.

There is no actual difference between [1] and [1&#039;] or between [2] and [2&#039;]. Which you prefer is a matter of taste. My purpose in writing the macros was simply to demonstrate that macros can be used to formalize a repeated syntactic pattern. I&#039;m not sure I&#039;d even use these macros myself, unless I felt like they really added to the clarity of the code.

One other possibility, which I failed to mention in the article, is that abstracting this pattern into macros could allow alternate implementations. For example, perhaps the macros could be made clever enough to use only local variables and omit the map parameter altogether for better performance. I don&#039;t actually know if this is possible in this case, but it&#039;s interesting to think about.</description>
		<content:encoded><![CDATA[<p>Dmitri: It&#8217;s not an explicit return call (which Clojure does not support) I just chose the name <code>return</code> because that&#8217;s where you put the code that manipulates the return value of the function. As I said, the <code>return</code> macro always has to be in tail position anyway.</p>
<p>There is no actual difference between [1] and [1'] or between [2] and [2']. Which you prefer is a matter of taste. My purpose in writing the macros was simply to demonstrate that macros can be used to formalize a repeated syntactic pattern. I&#8217;m not sure I&#8217;d even use these macros myself, unless I felt like they really added to the clarity of the code.</p>
<p>One other possibility, which I failed to mention in the article, is that abstracting this pattern into macros could allow alternate implementations. For example, perhaps the macros could be made clever enough to use only local variables and omit the map parameter altogether for better performance. I don&#8217;t actually know if this is possible in this case, but it&#8217;s interesting to think about.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Syntactic Pipelines by Dmitri</title>
		<link>http://stuartsierra.com/2012/05/16/syntactic-pipelines/comment-page-1#comment-44492</link>
		<dc:creator>Dmitri</dc:creator>
		<pubDate>Sat, 19 May 2012 17:45:34 +0000</pubDate>
		<guid isPermaLink="false">http://stuartsierra.com/?p=624#comment-44492</guid>
		<description>[edited for code formatting -S]

Shouldn&#039;t side-effecty stuff like logging be isolated from functions containing transformation logic? Are explicit return calls idiomatic in clojure? How does [1] really differs from [1&#039;], and [2] from [2&#039;]? I&#039;m not sure which is shorter.

&lt;pre&gt;[1]
(defpipe compute-step2 [delta]
  (return
   (assoc-in [:x :y] 42)
   (:update delta * 2)
   (:set gamma (+ delta 100))))

[1&#039;]
(defn compute-step2 [{:keys [delta] :as m}]
  (-&gt; m
      (assoc-in [:x :y] 42)
      (update-in [:delta] * 2)
      (assoc :gamma (+ delta 100))))

[2]
(defpipeline compute
  compute-step1
  compute-step2)

[2&#039;]
(def compute (comp compute-step2 compute-step1))&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>[edited for code formatting -S]</p>
<p>Shouldn&#8217;t side-effecty stuff like logging be isolated from functions containing transformation logic? Are explicit return calls idiomatic in clojure? How does [1] really differs from [1'], and [2] from [2']? I&#8217;m not sure which is shorter.</p>
<pre>[1]
(defpipe compute-step2 [delta]
  (return
   (assoc-in [:x :y] 42)
   (:update delta * 2)
   (:set gamma (+ delta 100))))

[1']
(defn compute-step2 [{:keys [delta] :as m}]
  (-&gt; m
      (assoc-in [:x :y] 42)
      (update-in [:delta] * 2)
      (assoc :gamma (+ delta 100))))

[2]
(defpipeline compute
  compute-step1
  compute-step2)

[2']
(def compute (comp compute-step2 compute-step1))</pre>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Syntactic Pipelines by Stuart</title>
		<link>http://stuartsierra.com/2012/05/16/syntactic-pipelines/comment-page-1#comment-44484</link>
		<dc:creator>Stuart</dc:creator>
		<pubDate>Thu, 17 May 2012 15:24:23 +0000</pubDate>
		<guid isPermaLink="false">http://stuartsierra.com/?p=624#comment-44484</guid>
		<description>Brian: re. having `return` automatically included in `defpipe`: that would make the macro implementation simpler, but would prevent you from putting anything else in the function body. I wanted `defpipe` functions to be able to do all the things real functions can do, including conditional branching and side effects. For example:

&lt;pre&gt;(defpipe foo [a b]
  (log &quot;This is foo&quot;)
  (if (&lt; a 100)
    (return (:update b + 100))
    (return)))&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Brian: re. having `return` automatically included in `defpipe`: that would make the macro implementation simpler, but would prevent you from putting anything else in the function body. I wanted `defpipe` functions to be able to do all the things real functions can do, including conditional branching and side effects. For example:</p>
<pre>(defpipe foo [a b]
  (log "This is foo")
  (if (< a 100)
    (return (:update b + 100))
    (return)))</pre>
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Syntactic Pipelines by Stuart</title>
		<link>http://stuartsierra.com/2012/05/16/syntactic-pipelines/comment-page-1#comment-44483</link>
		<dc:creator>Stuart</dc:creator>
		<pubDate>Thu, 17 May 2012 15:12:03 +0000</pubDate>
		<guid isPermaLink="false">http://stuartsierra.com/?p=624#comment-44483</guid>
		<description>Mike: Yes, it is slightly monadic in character. I&#039;ve never been convinced of the utility of monads outside of strictly pure functional languages like Haskell, but that may be simply because I&#039;ve never understood them.</description>
		<content:encoded><![CDATA[<p>Mike: Yes, it is slightly monadic in character. I&#8217;ve never been convinced of the utility of monads outside of strictly pure functional languages like Haskell, but that may be simply because I&#8217;ve never understood them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Syntactic Pipelines by Stuart</title>
		<link>http://stuartsierra.com/2012/05/16/syntactic-pipelines/comment-page-1#comment-44482</link>
		<dc:creator>Stuart</dc:creator>
		<pubDate>Thu, 17 May 2012 14:47:01 +0000</pubDate>
		<guid isPermaLink="false">http://stuartsierra.com/?p=624#comment-44482</guid>
		<description>Brian: typo fixed, thanks!</description>
		<content:encoded><![CDATA[<p>Brian: typo fixed, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Syntactic Pipelines by Brian Marick</title>
		<link>http://stuartsierra.com/2012/05/16/syntactic-pipelines/comment-page-1#comment-44481</link>
		<dc:creator>Brian Marick</dc:creator>
		<pubDate>Thu, 17 May 2012 14:22:37 +0000</pubDate>
		<guid isPermaLink="false">http://stuartsierra.com/?p=624#comment-44481</guid>
		<description>Nifty. Slight preference for having the default be that `defpipe` wraps the pipeline in `return` for you. (I&#039;d have to write `respond` without using `defpipe`, I suppose, but that&#039;s OK, since it&#039;s not really a pipe in the same sense that `compute-step1` and `compute-step2` are.)

Also, a typo, I think: in `compute-step1`, shouldn&#039;t the `set` be a `:set`?</description>
		<content:encoded><![CDATA[<p>Nifty. Slight preference for having the default be that `defpipe` wraps the pipeline in `return` for you. (I&#8217;d have to write `respond` without using `defpipe`, I suppose, but that&#8217;s OK, since it&#8217;s not really a pipe in the same sense that `compute-step1` and `compute-step2` are.)</p>
<p>Also, a typo, I think: in `compute-step1`, shouldn&#8217;t the `set` be a `:set`?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Syntactic Pipelines by Sunng</title>
		<link>http://stuartsierra.com/2012/05/16/syntactic-pipelines/comment-page-1#comment-44480</link>
		<dc:creator>Sunng</dc:creator>
		<pubDate>Thu, 17 May 2012 11:45:54 +0000</pubDate>
		<guid isPermaLink="false">http://stuartsierra.com/?p=624#comment-44480</guid>
		<description>Hi, Stuart,

Will you package these  code as a library?
It does great help to me. I am looking for way that I can use it in my application.</description>
		<content:encoded><![CDATA[<p>Hi, Stuart,</p>
<p>Will you package these  code as a library?<br />
It does great help to me. I am looking for way that I can use it in my application.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

