<?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: How I Know I Don&#8217;t Know Enough About Lisp Macros</title>
	<atom:link href="http://nklein.com/2009/06/how-i-know-i-dont-know-enough-about-lisp-macros/feed/" rel="self" type="application/rss+xml" />
	<link>http://nklein.com/2009/06/how-i-know-i-dont-know-enough-about-lisp-macros/</link>
	<description>software development and consulting</description>
	<lastBuildDate>Sun, 20 May 2012 18:07:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: olof</title>
		<link>http://nklein.com/2009/06/how-i-know-i-dont-know-enough-about-lisp-macros/comment-page-1/#comment-168</link>
		<dc:creator>olof</dc:creator>
		<pubDate>Mon, 13 Jul 2009 15:14:28 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=584#comment-168</guid>
		<description>well, you could use some reader macros to use a modified do-jump-table-cases

&lt;code&gt;
(defmacro do-jump-table-cases (&amp;rest options)
  `(list ,@(loop for ii from 0
	      for oo in options
	      collecting `&#039;(,ii ,oo)))))
&lt;/code&gt;

like this:

&lt;code&gt;
(defun bar (op-code)
  #.`(ecase op-code
     ,@(do-jump-table-cases
	 (write &quot;NOOP&quot;)
	 (write &quot;SYNC&quot;)
 	 (write &quot;QUIT&quot;))))
&lt;/code&gt;

which generates (at read time)

&lt;code&gt;
(defun bar (op-code)
  (ecase op-code
    (0 (write &quot;NOOP&quot;))
    (1 (write &quot;SYNC&quot;))
    (2 (write &quot;QUIT&quot;))))
&lt;/code&gt;

doesn&#039;t look so nice though ;)</description>
		<content:encoded><![CDATA[<p>well, you could use some reader macros to use a modified do-jump-table-cases</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><pre class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">(defmacro do-jump-table-cases (&amp;rest options)
  `(list ,@(loop for ii from 0
	      for oo in options
	      collecting `'(,ii ,oo)))))</pre></div>
<p>like this:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><pre class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">(defun bar (op-code)
  #.`(ecase op-code
     ,@(do-jump-table-cases
	 (write &quot;NOOP&quot;)
	 (write &quot;SYNC&quot;)
 	 (write &quot;QUIT&quot;))))</pre></div>
<p>which generates (at read time)</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><pre class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">(defun bar (op-code)
  (ecase op-code
    (0 (write &quot;NOOP&quot;))
    (1 (write &quot;SYNC&quot;))
    (2 (write &quot;QUIT&quot;))))</pre></div>
<p>doesn&#8217;t look so nice though <img src='http://nklein.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lisp Jump Tables :: nklein software</title>
		<link>http://nklein.com/2009/06/how-i-know-i-dont-know-enough-about-lisp-macros/comment-page-1/#comment-167</link>
		<dc:creator>Lisp Jump Tables :: nklein software</dc:creator>
		<pubDate>Mon, 13 Jul 2009 03:20:41 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=584#comment-167</guid>
		<description>[...] few weeks back, I posted about how I know that I have more to grok about Lisp macros. In that post, I needed to explain Lisp macros a bit for those not in the know. The example that I [...]</description>
		<content:encoded><![CDATA[<p>[...] few weeks back, I posted about how I know that I have more to grok about Lisp macros. In that post, I needed to explain Lisp macros a bit for those not in the know. The example that I [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark H.</title>
		<link>http://nklein.com/2009/06/how-i-know-i-dont-know-enough-about-lisp-macros/comment-page-1/#comment-128</link>
		<dc:creator>Mark H.</dc:creator>
		<pubDate>Thu, 25 Jun 2009 11:51:57 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=584#comment-128</guid>
		<description>It&#039;s a concatenative macro processor, arguments are taken from an explicit stack. Here&#039;s an example:

Example 2: 99 bottles of beer (http://99-bottles-of-beer.net/)

    `drink! ( u -- ) `{continue}${#}
    this-many-bottles of beer on the wall, this-many-bottles of beer.
    Take one down and pass it around, fewer-bottles of beer on the wall.

    {repeat}` 

    `oh-no! ( -- ) `No more bottles of beer on the wall, no more bottles of beer.` 

    `please! ( u -- u ) `{#}
    Go to the store and buy some more, this-many-bottles of beer on the wall.` 

    `this-many-bottles ( u -- u ) `[{dup} 0&amp; ~no more bottles~1&amp; ~1 bottle~{.} ~ bottles~]` 

    `fewer-bottles ( u -- u-1 ) `{--}$this-many-bottles` 

    99&amp; drink!
    oh-no!
    99&amp; please!</description>
		<content:encoded><![CDATA[<p>It&#8217;s a concatenative macro processor, arguments are taken from an explicit stack. Here&#8217;s an example:</p>
<p>Example 2: 99 bottles of beer (<a href="http://99-bottles-of-beer.net/" rel="nofollow">http://99-bottles-of-beer.net/</a>)</p>
<p>    `drink! ( u &#8212; ) `{continue}${#}<br />
    this-many-bottles of beer on the wall, this-many-bottles of beer.<br />
    Take one down and pass it around, fewer-bottles of beer on the wall.</p>
<p>    {repeat}` </p>
<p>    `oh-no! ( &#8212; ) `No more bottles of beer on the wall, no more bottles of beer.` </p>
<p>    `please! ( u &#8212; u ) `{#}<br />
    Go to the store and buy some more, this-many-bottles of beer on the wall.` </p>
<p>    `this-many-bottles ( u &#8212; u ) `[{dup} 0&amp; ~no more bottles~1&amp; ~1 bottle~{.} ~ bottles~]` </p>
<p>    `fewer-bottles ( u &#8212; u-1 ) `{&#8211;}$this-many-bottles` </p>
<p>    99&amp; drink!<br />
    oh-no!<br />
    99&amp; please!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pat</title>
		<link>http://nklein.com/2009/06/how-i-know-i-dont-know-enough-about-lisp-macros/comment-page-1/#comment-120</link>
		<dc:creator>pat</dc:creator>
		<pubDate>Wed, 24 Jun 2009 21:33:07 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=584#comment-120</guid>
		<description>That doesn&#039;t help me in my situation.  In my situation, the enclosing macro tries to make some determination based on the number of forms it contains.  If one of those forms is a &lt;em&gt;(progn&#160;...)&lt;/em&gt;, it will look like only one form instead of however many it contains.

In other situations, I want to splice something into the middle of a list... not into the middle of code.</description>
		<content:encoded><![CDATA[<p>That doesn&#8217;t help me in my situation.  In my situation, the enclosing macro tries to make some determination based on the number of forms it contains.  If one of those forms is a <em>(progn&nbsp;&#8230;)</em>, it will look like only one form instead of however many it contains.</p>
<p>In other situations, I want to splice something into the middle of a list&#8230; not into the middle of code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mathrick</title>
		<link>http://nklein.com/2009/06/how-i-know-i-dont-know-enough-about-lisp-macros/comment-page-1/#comment-119</link>
		<dc:creator>mathrick</dc:creator>
		<pubDate>Wed, 24 Jun 2009 19:55:58 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=584#comment-119</guid>
		<description>If you want more than one form, just wrap them all in PROGN. It&#039;s defined to preserve toplevelness, if that&#039;s your concern, so the following will work as you&#039;d expect it to when placed at the toplevel:

&lt;code&gt;
(progn
  (defclass ...)
  (defun ...)
  (defvar ...))
&lt;/code&gt;

</description>
		<content:encoded><![CDATA[<p>If you want more than one form, just wrap them all in PROGN. It&#8217;s defined to preserve toplevelness, if that&#8217;s your concern, so the following will work as you&#8217;d expect it to when placed at the toplevel:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><pre class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">(progn
  (defclass ...)
  (defun ...)
  (defvar ...))</pre></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: pat</title>
		<link>http://nklein.com/2009/06/how-i-know-i-dont-know-enough-about-lisp-macros/comment-page-1/#comment-113</link>
		<dc:creator>pat</dc:creator>
		<pubDate>Sat, 20 Jun 2009 01:47:49 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=584#comment-113</guid>
		<description>That&#039;s interesting.  I may have to tinker with it next time I&#039;m thinking of using m4 for something.  I&#039;ll have to look more closely, too.  I didn&#039;t see any examples of macros with arguments.</description>
		<content:encoded><![CDATA[<p>That&#8217;s interesting.  I may have to tinker with it next time I&#8217;m thinking of using m4 for something.  I&#8217;ll have to look more closely, too.  I didn&#8217;t see any examples of macros with arguments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark H.</title>
		<link>http://nklein.com/2009/06/how-i-know-i-dont-know-enough-about-lisp-macros/comment-page-1/#comment-112</link>
		<dc:creator>Mark H.</dc:creator>
		<pubDate>Sat, 20 Jun 2009 00:57:19 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=584#comment-112</guid>
		<description>While your experimenting with macros you might be interested in checking out the concatenative macro processor I&#039;ve been working on, it&#039;s an unusual take the topic: 

http://freshmeat.net/projects/minimac-macro-processor

Cheers,
 Mark H.</description>
		<content:encoded><![CDATA[<p>While your experimenting with macros you might be interested in checking out the concatenative macro processor I&#8217;ve been working on, it&#8217;s an unusual take the topic: </p>
<p><a href="http://freshmeat.net/projects/minimac-macro-processor" rel="nofollow">http://freshmeat.net/projects/minimac-macro-processor</a></p>
<p>Cheers,<br />
 Mark H.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

