<?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"
	>
<channel>
	<title>Comments on: A lisp macro virgin tells all</title>
	<atom:link href="http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/</link>
	<description>Programming, writing, programming about writing.</description>
	<pubDate>Sat, 05 Jul 2008 15:56:42 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Steve</title>
		<link>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/#comment-4841</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 26 Jun 2008 23:35:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevecooper.org/?p=57#comment-4841</guid>
		<description>&lt;p&gt;&lt;strong&gt;jeff:&lt;/strong&gt; --&lt;/p&gt;

&lt;p&gt;I don't think so in all cases, but it certainly works for some.&lt;/p&gt;

&lt;p&gt;Also, it's just prettier to write&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(domanytimes (x 10 y 10)
  (print (* x y))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;than it is to write&lt;/p&gt;

&lt;p&gt;(domanytimes (x 10 y 10)
      (lambda (a b) (print (* a b))))&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><strong>jeff:</strong> &#8211;</p>

<p>I don&#8217;t think so in all cases, but it certainly works for some.</p>

<p>Also, it&#8217;s just prettier to write</p>

<pre><code>(domanytimes (x 10 y 10)
  (print (* x y))
</code></pre>

<p>than it is to write</p>

<p>(domanytimes (x 10 y 10)
      (lambda (a b) (print (* a b))))</p>]]></content:encoded>
	</item>
	<item>
		<title>By: jeff</title>
		<link>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/#comment-4833</link>
		<dc:creator>jeff</dc:creator>
		<pubDate>Thu, 26 Jun 2008 20:03:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevecooper.org/?p=57#comment-4833</guid>
		<description>&lt;p&gt;can't u just do the same thing with a function that takes a closure as an arg.  You would have the loop in this function call the closure.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>can&#8217;t u just do the same thing with a function that takes a closure as an arg.  You would have the loop in this function call the closure.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/#comment-4695</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 24 Jun 2008 23:53:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevecooper.org/?p=57#comment-4695</guid>
		<description>&lt;p&gt;&lt;strong&gt;timbo:&lt;/strong&gt; --&lt;/p&gt;

&lt;p&gt;I actually meant it this way round, since this is the form you'd see in an SQL statement. Inside a macro, you can rewrite the list&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;'(DUEDATE &#62; TODAY)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;into your second form, within the body of the macro. SQL programmers don't get as thrown.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><strong>timbo:</strong> &#8211;</p>

<p>I actually meant it this way round, since this is the form you&#8217;d see in an SQL statement. Inside a macro, you can rewrite the list</p>

<pre><code>'(DUEDATE &gt; TODAY)
</code></pre>

<p>into your second form, within the body of the macro. SQL programmers don&#8217;t get as thrown.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Timbo</title>
		<link>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/#comment-4591</link>
		<dc:creator>Timbo</dc:creator>
		<pubDate>Tue, 24 Jun 2008 10:03:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevecooper.org/?p=57#comment-4591</guid>
		<description>&lt;p&gt;(....(DUEDATE &#62; TODAY))&lt;/p&gt;

&lt;p&gt;???&lt;/p&gt;

&lt;p&gt;(....(&#62; DUEDATE TODAY))&lt;/p&gt;

&lt;p&gt;Excellent work, otherwise.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>(&#8230;.(DUEDATE &gt; TODAY))</p>

<p>???</p>

<p>(&#8230;.(&gt; DUEDATE TODAY))</p>

<p>Excellent work, otherwise.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/#comment-1997</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 13 May 2008 18:24:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevecooper.org/?p=57#comment-1997</guid>
		<description>&lt;p&gt;&lt;strong&gt;@Foo:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Thanks for taking the time to code this, Foo. I appreciate it.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><strong>@Foo:</strong></p>

<p>Thanks for taking the time to code this, Foo. I appreciate it.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Foo</title>
		<link>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/#comment-1996</link>
		<dc:creator>Foo</dc:creator>
		<pubDate>Tue, 13 May 2008 18:05:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevecooper.org/?p=57#comment-1996</guid>
		<description>&lt;p&gt;Try this one, which is more in the spirit of dotimes.  If there are zero loop-list items, it runs the body once and returns nil.  Else it works like yours except if there's an extra single expression at the end of the loop-list it evaluates and returns it afterwards; else it returns nil.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(defmacro domanytimes (loop-list &#38;rest body)
  (if (oddp (length loop-list))
      `(progn (domanytimes ,(butlast loop-list 1) ,@body)
          ,(first (last loop-list)))
      (if loop-list
      `(dotimes ,(subseq loop-list 0 2)
         (domanytimes ,(rest (rest loop-list)) ,@body))
      `(progn ,@body))))
&lt;/code&gt;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>Try this one, which is more in the spirit of dotimes.  If there are zero loop-list items, it runs the body once and returns nil.  Else it works like yours except if there&#8217;s an extra single expression at the end of the loop-list it evaluates and returns it afterwards; else it returns nil.</p>

<pre><code>(defmacro domanytimes (loop-list &amp;rest body)
  (if (oddp (length loop-list))
      `(progn (domanytimes ,(butlast loop-list 1) ,@body)
          ,(first (last loop-list)))
      (if loop-list
      `(dotimes ,(subseq loop-list 0 2)
         (domanytimes ,(rest (rest loop-list)) ,@body))
      `(progn ,@body))))
</code></pre>]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/#comment-272</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 15 Apr 2008 18:19:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevecooper.org/?p=57#comment-272</guid>
		<description>&lt;p&gt;&lt;strong&gt;@bob&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Thanks, Bob!&lt;/p&gt;

&lt;p&gt;I haven't got to destructuring-bind yet... ;)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><strong>@bob</strong></p>

<p>Thanks, Bob!</p>

<p>I haven&#8217;t got to destructuring-bind yet&#8230; <img src='http://www.stevecooper.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Bane</title>
		<link>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/#comment-271</link>
		<dc:creator>Bob Bane</dc:creator>
		<pubDate>Tue, 15 Apr 2008 16:09:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevecooper.org/?p=57#comment-271</guid>
		<description>&lt;p&gt;Your macro would be slightly prettier (and a little more Lisp-idiomatic) like this:&lt;/p&gt;

&lt;pre&lt;code&gt;
  (defmacro domanytimes (loop-list &#38;body body)
    (if (null loop-list)
      &lt;code&gt;(progn ,@body)
      (destructuring-bind
         (fst rst . tail) loop-list&lt;/code&gt;(dotimes (,fst , rst) (domanytimes ,tail ,@body)))))&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Untested, and I hope I got the markup right...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Your macro would be slightly prettier (and a little more Lisp-idiomatic) like this:</p>

<pre <code>
  (defmacro domanytimes (loop-list &amp;body body)
    (if (null loop-list)
      <code>(progn ,@body)
      (destructuring-bind
         (fst rst . tail) loop-list</code>(dotimes (,fst , rst) (domanytimes ,tail ,@body)))))</pre>

<p>Untested, and I hope I got the markup right&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: leppie</title>
		<link>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/#comment-265</link>
		<dc:creator>leppie</dc:creator>
		<pubDate>Tue, 15 Apr 2008 06:26:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevecooper.org/?p=57#comment-265</guid>
		<description>&lt;p&gt;@Steve:&lt;/p&gt;

&lt;p&gt;Even I have to use it secretly at work! :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Steve:</p>

<p>Even I have to use it secretly at work! <img src='http://www.stevecooper.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: jay</title>
		<link>http://www.stevecooper.org/2008/04/12/a-lisp-macro-virgin-tells-all/#comment-262</link>
		<dc:creator>jay</dc:creator>
		<pubDate>Tue, 15 Apr 2008 04:24:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevecooper.org/?p=57#comment-262</guid>
		<description>&lt;p&gt;this actually works :) I had to separate the variable names from the values. The implementation is a little longer because DoManyTimes is a class and maintains state to pass to the block.&lt;/p&gt;

&lt;p&gt;DoManyTimes.run([3,3,3]) do &#124;x,y,z&#124;
  puts "#{x} #{y} #{z}"
end&lt;/p&gt;

&lt;p&gt;You can use an arbitrary number of indices. DoManyTimes([10,10,10,10,10]) do {x,y,z,a,b&#124; ... end&lt;/p&gt;

&lt;p&gt;I'm sure there is a better way to do this in ruby, but I got sidetracked because I realized it would be a lot easier in javascript, I think :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>this actually works <img src='http://www.stevecooper.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> I had to separate the variable names from the values. The implementation is a little longer because DoManyTimes is a class and maintains state to pass to the block.</p>

<p>DoManyTimes.run([3,3,3]) do |x,y,z|
  puts &#8220;#{x} #{y} #{z}&#8221;
end</p>

<p>You can use an arbitrary number of indices. DoManyTimes([10,10,10,10,10]) do {x,y,z,a,b| &#8230; end</p>

<p>I&#8217;m sure there is a better way to do this in ruby, but I got sidetracked because I realized it would be a lot easier in javascript, I think <img src='http://www.stevecooper.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
</channel>
</rss>
