<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1175266939384385294</id><updated>2011-11-26T15:46:15.254-08:00</updated><category term='Common Lisp'/><category term='CL-WHO'/><category term='HTML-TEMPLATE'/><category term='HTML'/><title type='text'>(within parens...)</title><subtitle type='html'>Marco Antoniotti's blog on Lisp and other interesting bits of programming.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-7092285712842354535</id><published>2011-11-17T08:06:00.000-08:00</published><updated>2011-11-17T08:18:17.671-08:00</updated><title type='text'>European Lisp Symposium 2012, Zadar, Croatia, April 30th - May 1st, 2012</title><content type='html'>&lt;p&gt;&lt;b&gt;Site:&lt;/b&gt; &lt;tt&gt;&lt;a href="http://european-lisp-symposium.org"&gt;http://european-lisp-symposium.org&lt;/a&gt;&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;The purpose of the European Lisp Symposium is to provide a forum for
the discussion and dissemination of all aspects of design,
implementation and application of any of the Lisp and Lisp-inspired
dialects, including Common Lisp, Scheme, Emacs Lisp, AutoLisp, ISLISP,
Dylan, Clojure, ACL2, ECMAScript, Racket, SKILL, and so on. We
encourage everyone interested in Lisp to participate.&lt;/p&gt;


&lt;p&gt;The main theme of the 2012 European Lisp Conference is
"Interoperabilty: Systems, Libraries, Workflows".  Lisp based and
functional-languages based systems have grown a variety of solutions
to become more and more integrated with the wider world of Information
and Communication Technologies in current use.  There are several
dimensions to the scope of the solutions proposed, ranging from
"embedding" of interpreters in C-based systems, to the development of
abstractions levels that facilitate the expression of complex context
dependent tasks, to the construction of exchange formats handling
libraries, to the construction of theorem-provers for the "Semantic
Web".  The European Lisp Symposium 2012 solicits the submission of
papers with this specific theme in mind, alongside the more
traditional tracks which have appeared in the past editions.&lt;/p&gt;

&lt;p&gt;We invite submissions in the following forms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Papers: Technical papers of up to 15 pages that describe original
results or explain known ideas in new and elegant ways.&lt;/li&gt;

&lt;li&gt;Demonstrations: Abstracts of up to 4 pages for demonstrations of
tools, libraries, and applications.&lt;/li&gt;

&lt;li&gt;Tutorials: Abstracts of up to 4 pages for in-depth presentations about
topics of special interest for at least 90 minutes and up to 180
minutes.&lt;/li&gt;

&lt;li&gt;Lightning talks: Abstracts of up to one page for talks to last for no
more than 5 minutes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All submissions should be formatted following the ACM SIGS guidelines
and include ACM classification categories and terms. For more
information on the submission guidelines and the ACM keywords, see:
&lt;tt&gt;&lt;a href="http://www.acm.org/sigs/publications/proceedings-templates"&gt;http://www.acm.org/sigs/publications/proceedings-templates&lt;/a&gt;&lt;/tt&gt; and
&lt;tt&gt;&lt;a href="http://www.acm.org/about/class/1998"&gt;http://www.acm.org/about/class/1998&lt;/a&gt;&lt;/tt&gt;.&lt;/p&gt;


&lt;h2&gt;Important dates:&lt;/h2&gt;

&lt;p&gt;&lt;ul&gt;
&lt;li&gt;Jan 31st 2012: submission deadline
&lt;li&gt;Feb 21st 2012: acceptance results

&lt;li&gt;April 30th, 2012 Conference opens
&lt;/ul&gt;
&lt;/p&gt;

&lt;h2&gt;Program Commitee:&lt;/h2&gt;

&lt;p&gt;&lt;b&gt;Chair:&lt;/b&gt;&lt;br /&gt;
Marco Antoniotti, Università degli Studi di Milano Bicocca, Milan, ITALY&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Local organizers:&lt;/b&gt;
&lt;ul&gt;
&lt;li&gt;Damir Ćavar, Eastern Michigan University
&lt;li&gt;Franjo Pehar, University of Zadar
&lt;li&gt;Damir Kero, University of Zadar
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Members:&lt;/b&gt;
&lt;ul&gt;
&lt;li&gt;Giuseppe Attardi, Università degli Studi di Pisa, Pisa, ITALY
&lt;li&gt;Pascal Costanza, Intel, Bruxelles, BELGIUM
&lt;li&gt;Marc Feeley, Université de Montreal, Montreal, CANADA
&lt;li&gt;Scott McKay, Google, U.S.A.
&lt;li&gt;Kent Pitman, Hypermeta, U.S.A.
&lt;li&gt;Christophe Rhodes, Department of Computing, Goldsmiths, University of London, London, UNITED KINGDOM
&lt;li&gt;Robert Strandh, LABRI, Université de Bordeaux, Bordaux, FRANCE
&lt;li&gt;Didier Verna, EPITA / LRDE, FRANCE
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-7092285712842354535?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/7092285712842354535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2011/11/european-lisp-symposium-2012-zadar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/7092285712842354535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/7092285712842354535'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2011/11/european-lisp-symposium-2012-zadar.html' title='European Lisp Symposium 2012, Zadar, Croatia, April 30th - May 1st, 2012'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-968483023640744960</id><published>2011-10-23T05:50:00.000-07:00</published><updated>2011-10-31T02:38:08.280-07:00</updated><title type='text'>Mokum ECML 2011</title><content type='html'>I am in Amsterdam for the &lt;a href="http://weitz.de/eclm2011/"&gt;ECLM 2011&lt;/a&gt; and I must say that I have a distinctive feeling that the CL world is somehow doing very well.  The meeting (as many of the readers know) is by invitation and the people presenting are from actual companies.  The presentations have given me a sense of solidity of the companies represented, which, in the very words of the people presenting their work, is a reflection of the goodness of the choices made both of "problem" and "technologies": Common Lisp always being in key nodes of the implementation.

Many thanks to &lt;a href="http://weitz.de"&gt;Edi Weitz&lt;/a&gt; and Arthur Lemmens for organizing the meeting.

&lt;hr&gt;&lt;br&gt;
(cheers)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-968483023640744960?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/968483023640744960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2011/10/mokum-ecml-2011.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/968483023640744960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/968483023640744960'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2011/10/mokum-ecml-2011.html' title='Mokum ECML 2011'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-4559506499434669261</id><published>2011-06-16T02:12:00.000-07:00</published><updated>2011-06-16T02:17:51.007-07:00</updated><title type='text'>CL-UNIFICATION system and package names aligned.</title><content type='html'>&lt;p&gt;NS rightly complains &lt;a href="http://random-state.net/log/3517036634.html"&gt;here&lt;/a&gt; about system and package names for &lt;a href="http://common-lisp.net/project/cl-unification/"&gt;CL-UNIFICATION&lt;/a&gt;.  I fixed the problem in CVS (it should take a little to propagate to &lt;a href="http://"&gt;Quicklisp&lt;/a&gt;) by adding the proper nickname to the package, i.e., &lt;code&gt;"CL-UNIFICATION"&lt;/code&gt;.  My excuse is that this was a left over from a few years back when nomenclature had not been as settled. :)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-4559506499434669261?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/4559506499434669261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2011/06/cl-unification-system-and-package-names.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/4559506499434669261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/4559506499434669261'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2011/06/cl-unification-system-and-package-names.html' title='CL-UNIFICATION system and package names aligned.'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-1271919401915156133</id><published>2011-06-14T02:05:00.000-07:00</published><updated>2011-06-16T05:21:25.223-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Common Lisp'/><title type='text'>Printing XHTMΛ</title><content type='html'>&lt;p&gt;I finally bit the bullet!  I swear I tried!  I pestered people!  I failed.  I.e., I failed to like any of the "major" HTML-producing libraries "out there" and so I rolled up my own.  In the process, I (re)learned a few things and I believe I made good use of parts of the language that are usually overlooked.&lt;/p&gt;

&lt;h2&gt;My problems with the other libraries&lt;/h2&gt;

&lt;p&gt;This section must start with an apology.&lt;/p&gt;

&lt;p&gt;All the libraries I tried, are very fine and sophisticated pieces of software that &lt;b&gt;do&lt;/b&gt; solve problems.  Alas, myself being a rotten Lisper, I found that I "needed something different" (read: "something I wrote").  Therefore, the comments you'll read below are &lt;b&gt;not&lt;/b&gt; to be intended as general statements about such libraries, but &lt;b&gt;only&lt;/b&gt; as testimony of my whims.&lt;/p&gt;

&lt;p&gt;The libraires I looked at are &lt;a href="http://www.cl-http.org:8001/cl-http/"&gt;CL-HTTP&lt;/a&gt;, &lt;a href="http://weitz.de/cl-who/"&gt;CL-WHO&lt;/a&gt; and variations of TFEB's &lt;a href="http://www.tfeb.org/lisp/hax.html#HTOUT"&gt;htout&lt;/a&gt; and Franz &lt;a href="http://allegroserve.sourceforge.net/aserve-dist/doc/htmlgen.html"&gt;htmlgen&lt;/a&gt;, especially in the XHTML-GENERATOR version that comes with &lt;a href="http://common-lisp.net/project/cxml/"&gt;CXML&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As I said, my idiosyncrasies with the the whole business of CL programming found problems with each of these otherwise fine libraries. More specifically, I found &lt;a href="http://www.cl-http.org:8001/cl-http/"&gt;CL-HTTP&lt;/a&gt; too heavy to use just to generate HTML.  One gripe I had with CL-WHO is that it did not handle &lt;em&gt;pretty printing&lt;/em&gt; of HTML well (indentation is off in "recursive" use); more or less the same can be said of htout and htmlgen.  CXML XHTML-GENERATOR is essentially a "round-trip" utilities and it makes your life quite unhappy if you are trying to use simple HTML entities like - surprise - &amp;lambda; and &amp;Lambda;.&lt;/p&gt;

&lt;p&gt;CL-WHO, htout, htmlgen and XHTML-GENERATOR all take the approach summarized as &lt;em&gt;I will compile a SExp representing "HTML" and will generate - in line - a set of specialized writing calls (yes: mostly &lt;code&gt;WRITE&lt;/code&gt; and &lt;code&gt;WRITE-STRING&lt;/code&gt;).&lt;/em&gt; (Cfr. the examples in CL-WHO documentation; .)&lt;/p&gt;

&lt;p&gt;There is nothing wrong with this approach, but it makes the resulting library and overall implementation more monolithic and it does not leverage some of the bells and whistles that you have available in &lt;strong&gt;CL&lt;/strong&gt;.
Thus I rolled my own (and I called it &lt;b&gt;XHTM&amp;Lambda;&lt;/b&gt;).&lt;/p&gt;

&lt;h2&gt;Yet another&lt;sup&gt;&lt;i&gt;n&lt;/i&gt;&lt;/sup&gt; HTML generation library&lt;/h2&gt;

&lt;p&gt;My approach to HTML (or XML) generation is the following:
&lt;ol&gt;
  &lt;li&gt;HTML (or XML!) element need not be "lists" or "conses"; they can be bona-fide objects, i.e., structures.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;print-object&lt;/code&gt;, and, above all, the &lt;em&gt;pretty printer&lt;/em&gt; are my friends.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;*print-pretty*&lt;/code&gt;, &lt;code&gt;*print-readably*&lt;/code&gt; etc., are more than useful.
&lt;/ol&gt;

&lt;p&gt;There are a few consequences from this choices and they should be exposed.  Before doing that, let's see what happens in the basic case.&lt;/p&gt;

&lt;p&gt;The basic definition in the implementation of XHTM&amp;Lambda; is the representation of a HTML (or XML!) "element".  It is very simple and it does accommodate the HTML5 bits and pieces.&lt;/p&gt;

&lt;p&gt;
&lt;pre&gt;&lt;code&gt;
(defstruct (&lt;span style="color: red"&gt;&lt;b&gt;element&lt;/b&gt;&lt;/span&gt; (:constructor %element))
   (tag        nil :type symbol)
   (attributes ()  :type list)
   (content    ()  :type list))&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tag&lt;/code&gt; is ... the tag, &lt;code&gt;attributes&lt;/code&gt; is a p-list and &lt;code&gt;content&lt;/code&gt; is a possibly empty list of other &lt;code&gt;element&lt;/code&gt;s.




&lt;h3&gt;"Printing" an element&lt;/h3&gt;

&lt;p&gt;Let's forget a minute about the constructor and let's instead concentrate on an element "printing" process.  The main entry point is a &lt;code&gt;print-object&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;
&lt;pre&gt;&lt;code&gt;
(defmethod &lt;b&gt;print-object&lt;/b&gt; ((e element) (s stream))
  (let ((tag (element-tag e))
        (attributes (element-attributes e))
        (content (element-content e))
        )
    (cond (&lt;b&gt;*print-pretty*&lt;/b&gt;
           (&lt;b&gt;&lt;span style="color: blue"&gt;pprint-xhtml&lt;/span&gt;&lt;/b&gt; s e))

          (&lt;b&gt;*print-readably*&lt;/b&gt;
           (format s &lt;span style="color: green"&gt;"#S(~S :TAG ~S :ATTRIBUTES ~S :CONTENT ~S)"&lt;/span&gt;
                   (type-of e)
                   tag
                   attributes
                   content))

          (t
           &lt;i&gt;&lt;span style="color: red"&gt;;; Format string showing-off!!!!&lt;/span&gt;&lt;/i&gt;
           (format s &lt;span style="color: green"&gt;"&lt;~A~{ ~A=\"~A\"~}~:[ /&gt;~;&gt;~:*~{~S~^ ~}&amp;lt;/~3:*~A&gt;~]"&lt;/span&gt;
                   (string-downcase tag)
                   attributes
                   content
                   )
           ))
    ))&lt;/code&gt;&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;The method is rather straightforward (apart from the last &lt;code&gt;format&lt;/code&gt; string, which does many things at once: (1) writes the attributes, (2) checks whether there is content and if not closes the tag, otherwise backs up to print it, and (3) finally it backs up again to the tag to print the proper closing element).  Note that, in order to properly and nicely printing the element, if &lt;code&gt;*print-pretty*&lt;/code&gt; is non-NIL, then the function &lt;code&gt;pprint-xhtml&lt;/code&gt; is called.&lt;/p&gt;

&lt;h4&gt;Using the pretty printer&lt;/h4&gt;

&lt;p&gt;It may be just me, but I believe that the pretty printer is an under-used part of the &lt;strong&gt;CL&lt;/strong&gt; standard.  Therefore, I set out to use it heavily in order to get "properly indented" (meaning, the way I like it) (X)HTML.  The function &lt;span style="color: blue"&gt;&lt;b&gt;&lt;code&gt;pprint-xhtml&lt;/code&gt;&lt;/b&gt;&lt;/span&gt; does that.&lt;/p&gt;

&lt;p&gt;
&lt;pre&gt;&lt;code&gt;
(defun &lt;span style="color: blue"&gt;&lt;b&gt;pprint-xhtml&lt;/b&gt;&lt;/span&gt; (s xhtml-element)
  (declare (type stream s)
           (type element xhtml-element))
  (let ((tag (string-downcase (element-tag xhtml-element)))
        (attrs (element-attributes xhtml-element))
        (content (element-content xhtml-element))
        )
    (&lt;span style="color: maroon"&gt;&lt;b&gt;pprint-logical-block&lt;/b&gt;&lt;/span&gt; (s content)  &lt;span style="color: red"&gt;; (1)&lt;/span&gt;
      (&lt;span style="color: maroon"&gt;&lt;b&gt;pprint-logical-block&lt;/b&gt;&lt;/span&gt; (s content)  &lt;span style="color: red"&gt;; (2)&lt;/span&gt;
        (format s &lt;span style="color: green"&gt;"&amp;lt;~A&lt;span style="color: maroon"&gt;&lt;b&gt;~@&amp;lt;&lt;/b&gt;&lt;/span&gt;~{~^ ~A=\"~S\"&lt;span style="color: maroon"&gt;&lt;b&gt;~^~_&lt;/b&gt;&lt;/span&gt;~}&lt;span style="color: maroon"&gt;&lt;b&gt;~:&amp;gt;&lt;/b&gt;&lt;/span&gt;"&lt;/span&gt; tag attrs)  &lt;span style="color: red"&gt;; (3)&lt;/span&gt;
      
        (when content
          (write-char #\&gt; s)
          (&lt;span style="color: maroon"&gt;&lt;b&gt;pprint-newline&lt;/b&gt;&lt;/span&gt; :mandatory s)
          (format s &lt;span style="color: green"&gt;"~{~4,0:T &lt;span style="color: maroon"&gt;&lt;b&gt;~:W~_&lt;/b&gt;&lt;/span&gt;~}"&lt;/span&gt; content)
          ))

      (if content
          (format s &lt;span style="color: green"&gt;"&lt;span style="color: maroon"&gt;&lt;b&gt;~0I&lt;/b&gt;&lt;/span&gt;&amp;lt;/~A&amp;gt;"&lt;/span&gt; tag)
          (format s &lt;span style="color: green"&gt;" /&amp;gt;"&lt;/span&gt;))
      )))
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;The function requires a few explanations (of course, if you are a "pretty printer black-belt" this may be a bit boring).  First of all, a display of what I want to obtain.&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;
&amp;lt;body style="color: red"&amp;gt;
    &amp;lt;p&amp;gt;
        Some text here
        &amp;lt;ul&amp;gt;
            &amp;lt;li&amp;gt;
                Line 1
            &amp;lt;/li&amp;gt;
        &amp;lt;/ul&amp;gt;
    &amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;This indentation may not be the best possible and there are some pitfalls, but it is better than what you get with the other
libraries.  But how does the function &lt;span style="color: blue"&gt;&lt;b&gt;&lt;code&gt;pprint-xhtml&lt;/code&gt;&lt;/b&gt;&lt;/span&gt; achieve this result while interacting with the pretty printing machinery?&lt;/p&gt;

&lt;p&gt;The function &lt;span style="color: blue"&gt;&lt;b&gt;&lt;code&gt;pprint-xhtml&lt;/code&gt;&lt;/b&gt;&lt;/span&gt; uses three &lt;em&gt;logical blocks&lt;/em&gt;.  Two for the element and a third for the attributes.  The logical block for the attributes is introduced in the &lt;code&gt;format&lt;/code&gt; string using the &lt;span style="color: maroon"&gt;&lt;b&gt;&lt;code&gt;~@&amp;lt;&amp;nbsp;...&amp;nbsp;~:&amp;gt;&lt;/code&gt;&lt;/b&gt;&lt;/span&gt; directive.  Note also the conditional newline &lt;span style="color: maroon"&gt;&lt;b&gt;&lt;code&gt;~_&lt;/code&gt;&lt;/b&gt;&lt;/span&gt; in the list iteration construction &lt;span style="color: maroon"&gt;&lt;b&gt;&lt;code&gt;~{&amp;nbsp;...&amp;nbsp;~}&lt;/code&gt;&lt;/b&gt;&lt;/span&gt;. The other two &lt;span style="color: maroon"&gt;&lt;b&gt;&lt;code&gt;pprint-logical-block&lt;/code&gt;&lt;/b&gt;&lt;/span&gt; establish the fence for the whole element and for the "inside" of the same.  The &lt;em&gt;outer&lt;/em&gt; &lt;span style="color: maroon"&gt;&lt;b&gt;&lt;code&gt;pprint-logical block&lt;/code&gt;&lt;/b&gt;&lt;/span&gt; serves essentially to print the closing tag (if needed) correctly indented.  The "inner"
&lt;span style="color: maroon"&gt;&lt;b&gt;&lt;code&gt;pprint-logical-block&lt;/code&gt;&lt;/b&gt;&lt;/span&gt; just serves to provide the correct indentation for the tag and the actual element content.  The &lt;span style="color: maroon"&gt;&lt;b&gt;&lt;code&gt;pprint-newline&lt;/code&gt;&lt;/b&gt;&lt;/span&gt; and the indentation directive in the &lt;code&gt;format&lt;/code&gt; string, do the rest.&lt;/p&gt;

&lt;p&gt;Once you wrap your head around it (it did take me some time!) it is very straightforward, and very powerful.&lt;/p&gt;

&lt;h5&gt;Bells and Whistles&lt;/h5&gt;

&lt;p&gt;The pretty printing machinery offers you more control over what you can do with it.  For the time being my code just uses one simple hook into the &lt;em&gt;pretty printer dispatch table&lt;/em&gt; in order to write strings "unquoted", but, potentially, this is the machine to provide fancier element layout.&lt;/p&gt;

&lt;p&gt;The actual "printing" of an element is controlled by a specialized macro (provisionally) called &lt;span style="color:
blue"&gt;&lt;b&gt;&lt;code&gt;with-html-syntax&lt;/code&gt;&lt;/b&gt;&lt;/span&gt; which calls &lt;code&gt;&lt;b&gt;&lt;a href="http://www.lispworks.com/documentation/HyperSpec/Body/f_wr_pr.htm#write"&gt;write&lt;/a&gt;&lt;/b&gt;&lt;/code&gt; with an appropriately setup &lt;code&gt;&lt;b&gt;:pprint-dispatch&lt;/b&gt;&lt;/code&gt; argument.&lt;/p&gt;  The variable &lt;span style="color:
blue"&gt;&lt;b&gt;&lt;code&gt;*xhtml-pd*&lt;/code&gt;&lt;/b&gt;&lt;/span&gt; holds the modified pretty print dispatch table, which it is initialized as follows (at a minimum):&lt;/p&gt;

&lt;p&gt;
&lt;pre&gt;&lt;code&gt;
(&lt;span style="color: blue"&gt;&lt;b&gt;set-pprint-dispatch&lt;/b&gt;&lt;/span&gt; 'element
                     'pprint-xhtml
                     0
                     *xhtml-pd*)

(&lt;span style="color: blue"&gt;&lt;b&gt;set-pprint-dispatch&lt;/b&gt;&lt;/span&gt; 'string
                     (lambda (s xhtml-string)
                        (write-string xhtml-string s))
                     0
                     *xhtml-pd*)&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;This is the result:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
&lt;i&gt;XHTMLAMBDA 29 &amp;gt;&lt;/i&gt; &lt;b&gt;(with-html-syntax (*standard-output* :print-pretty t)
                  (body (:style "color: red")
                        (p ()
                           "Some text here"
                           (ul ()
                               (li () "Line 1")))))&lt;/b&gt;
&amp;lt;body style="color: red"&amp;gt;
    &amp;lt;p&amp;gt;
        Some text here
        &amp;lt;ul&amp;gt;
            &amp;lt;li&amp;gt;
                Line 1
            &amp;lt;/li&amp;gt;
        &amp;lt;/ul&amp;gt;
    &amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&lt;i&gt;&amp;lt;body style="color: red"&amp;gt;&amp;lt;p&amp;gt;"Some text here" &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;"Line 1"&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/body&amp;gt;&lt;/i&gt;  &lt;span style="color: red"&gt;; This is value returned!&lt;/span&gt;

&lt;i&gt;XHTMLAMBDA 30 &amp;gt;&lt;/i&gt;&lt;/code&gt;&lt;/pre&gt;


&lt;h2&gt;XHTM&amp;Lambda; Syntax&lt;/h2&gt;

&lt;p&gt;As you have noted in the previous example, the syntax of a XHTM&amp;Lambda; elements is&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;
   (&lt;em&gt;tag&lt;/em&gt; &lt;em&gt;attributes&lt;/em&gt; . &lt;em&gt;content&lt;/em&gt;)&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;where each tag is implemented as a &lt;em&gt;macro&lt;/em&gt;, which is essentially in charge of delaying the evaluation of the content plus some other massaging, mostly flattening of the content lists, this is achieved by having each macro calling a first parsing step, which generates an "intermediate" form that eventually calls the &lt;code&gt;&lt;b&gt;element&lt;/b&gt;&lt;/code&gt; function (see below).  The following example shows a pretty standard trick:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
&lt;i&gt;XHTMLAMBDA 33 &amp;gt;&lt;/i&gt; &lt;b&gt;(with-html-syntax (*standard-output* :print-pretty t)
                  (body (:style "color: red")
                        (p ()
                           "Some text here"
                           (ul () (loop for i below 5
                                        collect (li () (format nil "Line ~D" i)))))))&lt;/b&gt;
&amp;lt;body style="color: red"&amp;gt;
    &amp;lt;p&amp;gt;
        Some text here
        &amp;lt;ul&amp;gt;
             &amp;lt;li&amp;gt;
                 Line 0
             &amp;lt;/li&amp;gt;
             &amp;lt;li&amp;gt;
                 Line 1
             &amp;lt;/li&amp;gt;
             &amp;lt;li&amp;gt;
                 Line 2
             &amp;lt;/li&amp;gt;
             &amp;lt;li&amp;gt;
                 Line 3
             &amp;lt;/li&amp;gt;
             &amp;lt;li&amp;gt;
                 Line 4
             &amp;lt;/li&amp;gt;
        &amp;lt;/ul&amp;gt;
    &amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;body style="color: red"&amp;gt;&amp;lt;p&amp;gt;"Some text here" &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;"Line 0"&amp;lt;/li&amp;gt; &amp;lt;li&amp;gt;"Line 1"&amp;lt;/li&amp;gt; &amp;lt;li&amp;gt;"Line 2"&amp;lt;/li&amp;gt; &amp;lt;li&amp;gt;"Line 3"&amp;lt;/li&amp;gt; &amp;lt;li&amp;gt;"Line 4"&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/body&amp;gt;

XHTMLAMBDA 34 &amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;




&lt;p&gt;Thus XHTM&amp;Lambda; is unlike most other libraries which just discriminate on the first element of a SExp, usually a keyword.  XHTM&amp;Lambda; wants more structure and it strives to be more easily extensible through "standard" and low-level machinery, cfr., the pretty printing machinery and CLOS.  As an aside, the &lt;code&gt;&lt;b&gt;%element&lt;/b&gt;&lt;/code&gt; constructor is there just to be called by a "factory" generic function called - you guessed it - &lt;span style="color: blue"&gt;&lt;code&gt;&lt;b&gt;element&lt;/b&gt;&lt;/code&gt;&lt;/span&gt;.&lt;/p&gt;

&lt;h3&gt;Other Syntaxes and the &lt;code&gt;HTMLIZE&lt;/code&gt; Macro&lt;/h3&gt;

&lt;p&gt;Yet there is value in the widely used alternative SExp syntax for HTML (and XML):&lt;p&gt;
&lt;p&gt;&lt;pre&gt;&lt;code&gt;
  (&lt;em&gt;tag&lt;/em&gt; . &lt;em&gt;content&lt;/em&gt;)&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
or
&lt;p&gt;&lt;pre&gt;&lt;code&gt;
  ((&lt;em&gt;tag&lt;/em&gt; . &lt;em&gt;attributes&lt;/em&gt;) . &lt;em&gt;content&lt;/em&gt;)&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;In order to accommodate such syntax (and also a "keyword-based" one), XHTM&amp;Lambda; provides a &lt;code&gt;&lt;b&gt;htmlize&lt;/b&gt;&lt;/code&gt; macro which does some more rewriting from the syntax just above (termed &lt;code&gt;:compact&lt;/code&gt;) to the "operator-and-attributes" syntax (termed &lt;code&gt;:standard&lt;/code&gt;).
&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;
&lt;i&gt;XHTMLAMBDA 39 &amp;gt;&lt;/i&gt; &lt;b&gt;(&lt;span style="color: blue"&gt;htmlize&lt;/span&gt;
                 ((body :style "color: red")
                  (p "Some text here"
                     (ul (loop for i below 5
                                  collect (li () (format nil "Line ~D" i))))))
                 )&lt;/b&gt;
&amp;lt;body style="color: red"&amp;gt;&amp;lt;p&amp;gt;"Some text here" &amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;"Line 0"&amp;lt;/li&amp;gt; &amp;lt;li&amp;gt;"Line 1"&amp;lt;/li&amp;gt; &amp;lt;li&amp;gt;"Line 2"&amp;lt;/li&amp;gt; &amp;lt;li&amp;gt;"Line 3"&amp;lt;/li&amp;gt; &amp;lt;li&amp;gt;"Line 4"&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/body&amp;gt;

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

&lt;h2&gt;Availability&lt;/h2&gt;

&lt;p&gt;The XHTM&amp;Lambda; library will be available "very soon"&amp;trade; in &lt;a href="http://common-lisp.net"&gt;common-lisp.net&lt;/a&gt;. Stay tuned!&lt;/p&gt;

&lt;h2&gt;References&lt;/h2&gt;

&lt;p&gt;[W93] Richard C. Waters, &lt;em&gt;Some Useful Lisp Algorithms: Part
2&lt;/em&gt;, Mitsubishi Electric Research Laboratories Technical Report
93-17, August, 1993.&lt;/p&gt;

&lt;p&gt;[S90] Guy L. Steele Jr., &lt;em&gt;Common Lisp, the Language&lt;/em&gt;,
2&lt;sup&gt;&lt;i&gt;nd&lt;/i&gt;&lt;/sup&gt; Edition, Digital Press, 1990.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-1271919401915156133?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/1271919401915156133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2011/06/printing-xhtm.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/1271919401915156133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/1271919401915156133'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2011/06/printing-xhtm.html' title='Printing XHTM&amp;Lambda;'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-9213516775703506584</id><published>2011-03-10T05:37:00.000-08:00</published><updated>2011-03-10T05:41:30.364-08:00</updated><title type='text'>NEW code and documentation for the NEW op library.</title><content type='html'>&lt;p&gt;I added code and updated the documentation for the NEW-OP library to handle &lt;tt&gt;STRUCTURE-CLASS&lt;/tt&gt; better.  Cfr., &lt;a href="http://common-lisp.net/project/new-op"&gt;NEW-OP&lt;/a&gt; on &lt;a href="http://common-lisp.net"&gt;common-lisp.net&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;hr /&gt;&lt;br /&gt;(cheers)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-9213516775703506584?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/9213516775703506584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2011/03/new-code-and-documentation-for-new-op.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/9213516775703506584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/9213516775703506584'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2011/03/new-code-and-documentation-for-new-op.html' title='NEW code and documentation for the NEW op library.'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-5365130915016780403</id><published>2011-02-25T01:31:00.000-08:00</published><updated>2011-02-25T03:42:27.517-08:00</updated><title type='text'>:constructor tricks</title><content type='html'>&lt;p&gt;Every once in a while I discover things in CL that somehow I had not thought about before.  They have been there sometimes since &lt;a href="http://www.ida.liu.se/imported/cltl/cltl2.html"&gt;CLtL1&lt;/a&gt; but, somehow, I did not register them before. (I am slow, I know; and I am not claiming that this is anything new.  But this is the Internet :) )&lt;/p&gt;

&lt;p&gt;Fancy &lt;code&gt;:constructor&lt;/code&gt; uses are one of these things.&lt;/p&gt;

&lt;p&gt;Suppose you wanted to construct a &lt;em&gt;immutable&lt;/em&gt; tree node structure which recorded the height of the sub-tree upon construction.  Here is an iteration of what you may do.&lt;/p&gt;&lt;p&gt;
&lt;/p&gt;&lt;pre&gt;
(defstruct node
   (height 0)
   left
   right)
&lt;/pre&gt;
&lt;p&gt;Now you need to create the constructor for &lt;code&gt;node&lt;/code&gt;s.  Not worrying about &lt;code&gt;nil&lt;/code&gt; nodes, you may start by doing the obvious (assuming a &lt;code&gt;max*&lt;/code&gt; function capable of dealing with &lt;code&gt;nil&lt;/code&gt; values):
&lt;/p&gt;&lt;pre&gt;
(defun build-node (l r)
   (make-node :left l
              :right r
              :height (1+ (max* (node-height l) (node-height r)))))
&lt;/pre&gt;
Ok. Fine.  But why having &lt;b&gt;two&lt;/b&gt; constructors, with the standard &lt;code&gt;make-node&lt;/code&gt; essentially useless (you would not want to advertise it, as &lt;code&gt;height&lt;/code&gt; is a computed slot)?&lt;/p&gt;

&lt;p&gt;However, you can do the following:
&lt;/p&gt;&lt;pre&gt;
(defstruct (node
           (:constructor make-node (left right
                                    &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;&amp;amp;aux&lt;/span&gt;
                                    (height (1+ (max* (node-height left) (node-height right))))))
   (height 0)
   left
   right)
&lt;/pre&gt;
This will work as expected; the key trick is to leverage the &lt;code&gt;&amp;amp;aux&lt;/code&gt; parameter to collect the computation.  Adding the appropriate &lt;code&gt;:read-only&lt;/code&gt; declarations, you end up with:
&lt;pre&gt;
(defstruct (node
           (:constructor make-node (left right
                                    &amp;amp;aux
                                    (height (1+ (max* (node-height left) (node-height right))))))
   (height  0 :read-only t :type (mod 42))
   (left  nil :read-only t :type (or null node))
   (right nil :read-only t :type (or null node))
&lt;/pre&gt;
A perfectly fine immutable &lt;code&gt;node&lt;/code&gt; structure.&lt;p&gt;&lt;/p&gt;
&lt;hr /&gt;&lt;p&gt;(cheers)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-5365130915016780403?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/5365130915016780403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2011/02/constructor-tricks.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/5365130915016780403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/5365130915016780403'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2011/02/constructor-tricks.html' title=':constructor tricks'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-4571999915543027459</id><published>2011-02-24T08:02:00.000-08:00</published><updated>2011-02-24T08:45:06.789-08:00</updated><title type='text'>NEW structure and class constructor handling?</title><content type='html'>&lt;p&gt;In a previous &lt;a href="http://within-parens.blogspot.com/2010/10/new-post.html"&gt;post&lt;/a&gt; I mused about having a &lt;i&gt;new&lt;/i&gt; &lt;tt&gt;new&lt;/tt&gt; operator for Common Lisp.&lt;/p&gt;

&lt;p&gt;The only rub in the scheme I came up with was the handling of DEFSTRUCT constructors, which had to be somehow recorded in the system in order to make them known to the &lt;tt&gt;new&lt;/tt&gt; operator.&lt;/p&gt;

&lt;p&gt;The solution was less than satisfactory, and I had been thinking about how to come up with something more pleasant.  Now I believe I found something acceptable by relaxing the basic &lt;tt&gt;new&lt;/tt&gt; invariant (cfr., the &lt;a href="http://common-lisp.net/project/new-op/"&gt;spec&lt;/a&gt;) and admitting two "pseudo" types as arguments.  Suppose we had a "pseudo" type &lt;tt&gt;(&lt;b&gt;class&lt;/b&gt; &lt;i&gt;class-name&lt;/i&gt;)&lt;/tt&gt; and a "pseudo" type &lt;tt&gt;(&lt;b&gt;struct&lt;/b&gt; &lt;i&gt;structure-class-name&lt;/i&gt;)&lt;/tt&gt;.  Now I could write:
&lt;/p&gt;&lt;pre&gt;
cl-prompt&amp;gt; &lt;b&gt;(defclass foo () ())&lt;/b&gt;
&lt;i&gt;#&amp;lt;STANDARD CLASS FOO&amp;gt;&lt;/i&gt;

cl-prompt&amp;gt; &lt;b&gt;(newq &lt;span font="color: red;"&gt;(class foo)&lt;/span&gt;)&lt;/b&gt;
&lt;i&gt;#&amp;lt;FOO @ 42&amp;gt;&lt;/i&gt;
&lt;/pre&gt;
The twist is that now I have the right structure to plug in the constructor for structures.
&lt;pre&gt;
cl-prompt&amp;gt; &lt;b&gt;(defstruct baz q w e)&lt;/b&gt;
&lt;i&gt;BAZ&lt;/i&gt;

cl-prompt&amp;gt; &lt;b&gt;(newq &lt;span font="color: red;"&gt;(struct baz)&lt;/span&gt; :q 42)&lt;/b&gt;
&lt;i&gt;#S(BAZ :Q 42 :W NIL :E NIL)&lt;/i&gt; ; The standard MAKE-BAZ constructor is called.

cl-prompt&amp;gt; &lt;b&gt;(defstruct (bar (:constructor barify (a s &amp;amp;optional d)
                           (:constructor new-bar))
               a s d)&lt;/b&gt;
&lt;i&gt;BAR&lt;/i&gt;

cl-prompt&amp;gt; &lt;b&gt;(newq &lt;span font="color: red;"&gt;(struct bar :by barify)&lt;/span&gt; 1 2)&lt;/b&gt;
&lt;i&gt;#S(BAR :A 1 :S 2 :D NIL)&lt;/i&gt;

cl-prompt&amp;gt; &lt;b&gt;(newq &lt;span font="color: red;"&gt;(struct bar :by new-bar)&lt;/span&gt; :s 2 :a 1)&lt;/b&gt;
&lt;i&gt;#S(BAR :A 1 :S 2 :D NIL)&lt;/i&gt;
&lt;/pre&gt;

&lt;p&gt;I think this does it and it is not so bad.  Any comments?&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;(cheers)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-4571999915543027459?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/4571999915543027459/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2011/02/new-structure-and-class-constructor.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/4571999915543027459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/4571999915543027459'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2011/02/new-structure-and-class-constructor.html' title='NEW structure and class constructor handling?'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-5139601149631851758</id><published>2011-02-16T02:20:00.000-08:00</published><updated>2011-02-16T02:34:36.587-08:00</updated><title type='text'>EQUALITY and COMPARISON to CDR</title><content type='html'>I submitted the proposal for equality and comparison (cfr. &lt;a href="http://within-parens.blogspot.com/2011/01/all-things-being-equal.html"&gt;my previous post&lt;/a&gt;) to the &lt;a href="http://cdr.eurolisp.org"&gt;CDR&lt;/a&gt; discussion fora.

&lt;hr /&gt;
(cheers)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-5139601149631851758?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/5139601149631851758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2011/02/i-submitted-proposal-for-equality-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/5139601149631851758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/5139601149631851758'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2011/02/i-submitted-proposal-for-equality-and.html' title='EQUALITY and COMPARISON to CDR'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-5913022619259711336</id><published>2011-01-30T09:21:00.000-08:00</published><updated>2011-01-31T07:26:31.050-08:00</updated><title type='text'>All things being equal...</title><content type='html'>&lt;p&gt;Alright, this has been floating around for some time and it is time to write it up.&lt;/p&gt;

&lt;p&gt;Several object-oriented languages (e.g., Java, Ruby, C++, etc.) have ways to define &lt;em&gt;equality&lt;/em&gt; and &lt;em&gt;comparison&lt;/em&gt; operators or methods.  In Java the &lt;tt&gt;Object&lt;/tt&gt; class defines the &lt;tt&gt;equals&lt;/tt&gt; method, which can be specialized in user code and the &lt;tt&gt;Comparable&amp;lt;T&amp;gt;&lt;/tt&gt; interface.&lt;/p&gt;

&lt;p&gt;In Common Lisp, while all the machinery is there to provide such facilities, there has been no push to provide them.  I think there are two reasons for this.  The first one lies in the widespread use of &lt;tt&gt;:test&lt;/tt&gt; keywords and the programming style it encourages, especially when writing libraries.  The second in the influential KMP's paper on &lt;a href="http://www.nhplace.com/kent/PS/EQUAL.html"&gt;&lt;em&gt;The Best of Intentions: EQUAL Rights - and Wrongs - in Lisp&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The first reason does not really needs discussing, the second, a bit.  In my honest opinion, there are no real reasons not to have a notion of generic equality (and comparisons) on top of the standard &lt;tt&gt;:test&lt;/tt&gt; machinery, provided that some caution is taken.&lt;/p&gt;

&lt;p&gt;Having said so, I built methods for the following generic functions.

&lt;/p&gt;&lt;pre&gt;
(defgeneric &lt;span style="color: red"&gt;AEQUALIS&lt;/span&gt; (a b &amp;amp;rest keys &amp;amp;key recursive-p &amp;amp;allow-other-keys)
 (:method ((a T) (b T) &amp;amp;rest keys &amp;amp;key recursive-p &amp;amp;allow-other-keys)
    (eq a b))
 )

(defgeneric &lt;span style="color: red"&gt;COMPARE&lt;/span&gt; (a b &amp;amp;rest keys &amp;amp;key recursive-p &amp;amp;allow-other-keys)
   ...)
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;AEQUALIS&lt;/tt&gt; is Latin for "equal".  The generic function &lt;tt&gt;COMPARE&lt;/tt&gt; returns &lt;tt&gt;&amp;lt;&lt;/tt&gt;, &lt;tt&gt;&amp;gt&lt;/tt&gt;, &lt;tt&gt;=&lt;/tt&gt;, or &lt;tt&gt;/=&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;I prepared a specification for them (and an implementation) in order to post a &lt;a href="http://cdr.eurolisp.org/"&gt;CDR&lt;/a&gt;.  You can find it in the 
&lt;a href="https://docs.google.com/leaf?id=0ByVeTqcPbn1sNzliMjc1NTQtNjlkNC00M2Y5LTg5ZTAtYmRlNWU5OTcwMDAx&amp;amp;hl=en"&gt;CLEQCMP&lt;/a&gt; directory on my Google docs.&lt;/p&gt;

&lt;p&gt;Comments welcome.&lt;/p&gt;

&lt;p&gt;Enjoy&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;(cheers)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-5913022619259711336?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/5913022619259711336/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2011/01/all-things-being-equal.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/5913022619259711336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/5913022619259711336'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2011/01/all-things-being-equal.html' title='All things being equal...'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-7591790667264981311</id><published>2011-01-07T07:13:00.000-08:00</published><updated>2011-01-07T07:19:41.477-08:00</updated><title type='text'>NEW project on common-lisp.net</title><content type='html'>There is a &lt;b&gt;NEW&lt;/b&gt; project on &lt;a href="http://common-lisp.net"&gt;common-lisp.net&lt;/a&gt;.  The &lt;a href="http://common-lisp.net/project/new-op"&gt;new-op&lt;/a&gt; pages contain documentation and download instructions to get the code for the &lt;code&gt;new&lt;/code&gt; operator in Common Lisp I described in a previous &lt;a href="http://within-parens.blogspot.com/2010/10/new-post.html"&gt;post&lt;/a&gt;.

&lt;hr&gt;
(cheers)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-7591790667264981311?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/7591790667264981311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2011/01/new-project-on-common-lispnet.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/7591790667264981311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/7591790667264981311'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2011/01/new-project-on-common-lispnet.html' title='NEW project on common-lisp.net'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-8537083022507236758</id><published>2010-12-19T05:25:00.000-08:00</published><updated>2010-12-19T05:31:57.035-08:00</updated><title type='text'>CLAZY and ENUMERATIONS</title><content type='html'>&lt;p&gt;I submitted &lt;a href="http://common-lisp.net/project/clazy"&gt;CLAZY&lt;/a&gt; and &lt;a href="http://common-lisp.net/project/cl-enumeration/"&gt;CL-ENUMERATIONS&lt;/a&gt; to &lt;a href="http://www.quicklisp.org/"&gt;Quicklisp&lt;/a&gt; and found out that there were some problems with them.  Mostly due to (unwarranted) package locks in SBCL and CLISP.  Fixing these problems led to some revisitation of the code base and subsequent improvements (I hope).&lt;/p&gt;

&lt;p&gt;Both libraries should appear in future &lt;a href="http://www.quicklisp.org/"&gt;Quicklisp&lt;/a&gt; releases.&lt;/p&gt;

&lt;hr&gt;
(cheers)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-8537083022507236758?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/8537083022507236758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2010/12/clazy-and-enumerations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/8537083022507236758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/8537083022507236758'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2010/12/clazy-and-enumerations.html' title='CLAZY and ENUMERATIONS'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-8017646922775667978</id><published>2010-12-06T07:05:00.000-08:00</published><updated>2010-12-06T08:37:46.060-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Common Lisp'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML-TEMPLATE'/><category scheme='http://www.blogger.com/atom/ns#' term='CL-WHO'/><title type='text'>HTML in Common Lisp: code or fill?</title><content type='html'>&lt;p&gt;I finally got around to write my very own HTML documentation system.  Of course, this may be pointless and useless, but I found the alternatives "out there" lacking this or that (obviously!).  So here I am, trying to automate the process of producing documentation like that of &lt;a href="http://common-lisp.net/project/clazy/"&gt;CLAZY&lt;/a&gt;, which I hand-crafted in the past.  In the process, needless to say, I got carried away and got lost in the land of &lt;i&gt;featurism&lt;/i&gt; only to contemplate my overall ignorance of most things webbish.&lt;/p&gt;

&lt;p&gt;As usual, &lt;a href="http://weitz.de/"&gt;Edi Weitz&lt;/a&gt; came to my rescue by offering his &lt;a href="http://weitz.de/cl-who/"&gt;CL-WHO&lt;/a&gt; and &lt;a href="http://weitz.de/html-template/"&gt;HTML-TEMPLATE&lt;/a&gt;, which raised a question: which of the two approaches is best?  Note that the answer should consider how many dependencies my system files can have.&lt;/p&gt;

&lt;p&gt;Let's start with the simple problem I have: I need to produce a &lt;tt&gt;.html&lt;/tt&gt; file that contains, say, a "header" for my documentation.  I could do it using &lt;a href="http://weitz.de/cl-who/"&gt;CL-WHO&lt;/a&gt; in the following way (just a snippet, not working...)&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;&lt;pre&gt;
(defun produce-header-file (fs header-pathname)
(declare (type frameset fs)
      (type pathname header-pathname))
(let ((fs-order (frameset-order fs))
   (fs-head-title (frameset-head-title fs))
   (fs-body-title (frameset-body-title fs))
   )
(with-open-file (hs header-pathname
                   :direction :output
                   :if-exists :supersede
                   :if-does-not-exist :create)
 (&lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;with-html-output&lt;/span&gt; (hs hs :indent t)
   (&lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;fmt&lt;/span&gt; "~A&lt;!-- ~A.html --&gt;" (cl-fad:pathname-as-file header-pathname))
   (&lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;fmt&lt;/span&gt; +doctype-frameset-control-string+)
   (&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;:html&lt;/span&gt;
    (&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;:head&lt;/span&gt;
     (&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;:title&lt;/span&gt; (&lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;str&lt;/span&gt; fs-head-title))
     (&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;:link&lt;/span&gt; :rel "stylesheet" :href "clstyle.css"))
    (&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;:body&lt;/span&gt; :style "margin: 0pt 0pt 0pt 0pt;"
     (&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;:div&lt;/span&gt;
      :class "header"
      :style "padding-left: 2em; padding-top: 5pt; color: #41286f; font-size: 14pt"
      (&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;:strong&lt;/span&gt; (&lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;str&lt;/span&gt; fs-body-title))
      (&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;:div&lt;/span&gt;
       :class "navigation"
       :style "right: 2m"
       (&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;:a&lt;/span&gt;
        :href "index.html"
        :class "navigation-link-selected"
        :target "_parent"
        (&lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;str&lt;/span&gt; "Home"))
       )))))
 )))
&lt;/pre&gt;

&lt;p&gt;Or I could use &lt;a href="http://weitz.de/html-template/"&gt;HTML-TEMPLATE&lt;/a&gt; and ship around a "template" file like the following (again, this is just a snippet and contains errors):&lt;/p&gt;

&lt;pre&gt;
&amp;lt;!-- header.html --&amp;gt;

&amp;lt;!DOCTYPE HTML PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&amp;gt;

&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;title&amp;gt;&amp;lt;!-- &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;TMPL_VAR&lt;/span&gt; &lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;HEAD_TITLE&lt;/span&gt; --&amp;gt;&amp;lt;/title&amp;gt;
&amp;lt;link rel="stylesheet" href="clstyle.css"&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body style="margin: 0pt 0pt 0pt 0pt;"&amp;gt;

&amp;lt;div class="header"
style="padding-left: 2em; padding-top: 5pt;  "&amp;gt;
&amp;lt;strong&amp;gt;&amp;lt;i&amp;gt;&amp;lt;!-- &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;TMPL_VAR&lt;/span&gt; &lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;BODY_TITLE&lt;/span&gt; --&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/strong&amp;gt;&amp;lt;br/&amp;gt;

&amp;lt;div class="navigation" style="right: 2m"&amp;gt;
&amp;lt;!-- &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;TMPL_LOOP&lt;/span&gt; &lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;frames&lt;/span&gt; --&amp;gt;
&amp;lt;!-- &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;TMPL_IF&lt;/span&gt; &lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;current_frame&lt;/span&gt; --&amp;gt;
&amp;lt;a href=&amp;lt;!-- &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;TMPL_VAR&lt;/span&gt; &lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;frame&lt;/span&gt; --&amp;gt; class="navigation-link-selected" target=_parent&amp;gt;&amp;lt;!-- &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;TMPL_VAR&lt;/span&gt; f&lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;_nav_name&lt;/span&gt; -&amp;gt;&amp;gt;&amp;lt;/a&amp;gt;
&amp;lt;!-- &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;TMPL_ELSE&lt;/span&gt; --&amp;gt;
&amp;lt;a href=&amp;lt;!-- &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;TMPL_VAR&lt;/span&gt; &lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;frame&lt;/span&gt; --&amp;gt; class="navigation-link" target=_parent&amp;gt;&amp;lt;!-- &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;TMPL_VAR&lt;/span&gt; &lt;span class="Apple-style-span"  style="color:#3333FF;"&gt;f_nav_name&lt;/span&gt; -&amp;gt;&amp;gt;&amp;lt;/a&amp;gt;
&amp;lt;!-- &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;/TMPL_IF&lt;/span&gt; --&amp;gt;
&amp;lt;!-- &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;/TMPL_LOOP&lt;/span&gt; --&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;/div&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

&amp;lt;!-- end of file : header.html --&amp;gt;
&lt;/pre&gt;

&lt;p&gt;I am inclined to go the &lt;a href="http://weitz.de/cl-who/"&gt;CL-WHO&lt;/a&gt; way.  I do not have to ship around an extra file and record its location etc etc; yet the &lt;a href="http://weitz.de/html-template/"&gt;HTML-TEMPLATE&lt;/a&gt; does have appeal.  Any ideas out there?&lt;/p&gt;

&lt;hr /&gt;

(cheers)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-8017646922775667978?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/8017646922775667978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2010/12/html-in-common-lisp-code-or-fill.html#comment-form' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/8017646922775667978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/8017646922775667978'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2010/12/html-in-common-lisp-code-or-fill.html' title='HTML in Common Lisp: code or fill?'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-2375854429373307597</id><published>2010-10-05T08:04:00.000-07:00</published><updated>2011-06-16T05:26:11.795-07:00</updated><title type='text'>NEW post</title><content type='html'>&lt;p&gt;Hello,

&lt;p&gt;here is a NEW post after a long time.  And the topic of this post is NEW.  Of course, this is old stuff, but here it is: it's a post about the &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;new&lt;/span&gt; operator.  I'd bet there are many other little hacks like this floating around, but I finally got sucked in into writing a little library that introduces a &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;new&lt;/span&gt; operator (and a &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;newq&lt;/span&gt; one) in Common Lisp.
&lt;/p&gt;

&lt;p&gt;Why?  After a very long time of putting up with &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;make-instance &lt;/span&gt;and &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;make-this&lt;/span&gt; and &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;make-that&lt;/span&gt;, and after many other brain things going on in my head (cit. King Julien of the Lemurs) I decided that Common Lisp needed something capable of doing the following:&lt;/p&gt;

&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;cl-prompt&gt; &lt;b&gt;(defclass foo () ())&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;i&gt;FOO&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;cl-prompt&gt; &lt;b&gt;(&lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;new&lt;/span&gt; 'foo)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;i&gt;#&amp;lt;FOO instance 42&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;foo&gt;&lt;/foo&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;

&lt;p&gt;or even&lt;/p&gt;

&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;
&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;cl-prompt&gt; &lt;b&gt;(&lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;newq&lt;/span&gt; foo)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;i&gt;#&lt;foo&gt;&lt;/foo&gt;&amp;lt;FOO instance 42&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;

&lt;p&gt;So; what's the big deal? Not much, but I also want to be able to write:&lt;/p&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;cl-prompt&gt; &lt;b&gt;(&lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;newq&lt;/span&gt; &lt;span class="Apple-style-span"  style="color:#6633FF;"&gt;(array single-float (2 2))&lt;/span&gt; '((1.0 0.0) (0.0 1.0)))&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;i&gt;#2A((1.0 0.0) (0.0 1.0))&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;

&lt;p&gt;The problem is that as soon as you wade in CL "type specifiers" land, you hit the dreaded "implementation dependent" wall, or, worse, the "this is not even mentioned in the ANSI spec" wall.  Think of &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;DEFSTRUCT&lt;/span&gt; and the fact that there is no portable way to get to the constructor, not to mention &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;DEFTYPE&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;Apart from that, I think that the little piece of code I wrote would maybe make programming in CL feel more in tune with the times.  After all you can also write things like the following, which I think are rather cool.&lt;/p&gt;

&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;cl-prompt&gt; &lt;b&gt;(new '(mod 42) (read))&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;1024&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;i&gt;Error: 1024 is not of type (INTEGER 0 (42)).&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;i&gt;...&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;p&gt;What do you think?  Is this worth a CDR?  Ping me if you want to see the code.&lt;/p&gt;&lt;div&gt;
&lt;/div&gt;&lt;hr /&gt;(cheers)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-2375854429373307597?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/2375854429373307597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2010/10/new-post.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/2375854429373307597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/2375854429373307597'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2010/10/new-post.html' title='NEW post'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-9093841461805931990</id><published>2009-05-26T00:29:00.000-07:00</published><updated>2009-05-26T00:31:31.490-07:00</updated><title type='text'>ELS 2009 tomorrow</title><content type='html'>Here it is.

Tomorrow there will be the reception for the opening of the 2nd European Lisp Symposium 2009 in Milan (www.european-lisp-symposium.org)

I look forward to see many of you here in Milan.

&lt;hr&gt;
(cheers)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-9093841461805931990?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/9093841461805931990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2009/05/els-2009-tomorrow.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/9093841461805931990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/9093841461805931990'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2009/05/els-2009-tomorrow.html' title='ELS 2009 tomorrow'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-1000802114857209919</id><published>2009-04-15T03:30:00.000-07:00</published><updated>2009-04-15T04:41:05.433-07:00</updated><title type='text'>CL-UNIFICATION does regexps (thanks to Edi Weitz)</title><content type='html'>&lt;p&gt;I have been working for some time on the &lt;a href="http://common-lisp.net/project/cl-unification/"&gt;CL-UNIFICATION&lt;/a&gt; library. Somehow, "unification" and "parsing" are related but not quite (I bet the literature on the topic is huge).  In an afternoon of the Easter vacation, I decided to take the easy way out of extending &lt;a href="http://common-lisp.net/project/cl-unification/"&gt;CL-UNIFICATION&lt;/a&gt; with some "parsing" functionality: I just added Edi Weitz's wonderful &lt;a href="http://www.weitz.de/cl-ppcre/"&gt;CL-PPCRE&lt;/a&gt; library.  Edis' library has a very simple and intuitive interface which made the integration a SMOP!

The result is the following.  Now you can write the following (assuming all the packages are USEed):

&lt;pre&gt;
(&lt;b&gt;unify&lt;/b&gt; &lt;span style="color: red"&gt;#T(regexp "a(b+)c(d+)" (?bs ?ds))&lt;/span&gt; "abbbbcddd")
&lt;/pre&gt;

The call will produce an environment where &lt;tt&gt;?BS&lt;/tt&gt; is bound to &lt;tt&gt;"bbbb"&lt;/tt&gt; and &lt;tt&gt;?DS&lt;/tt&gt; is bound to &lt;tt&gt;"ddd"&lt;/tt&gt;.  Here is a full transcript.

&lt;pre&gt;
CL-USER 3 &amp;gt; &lt;b&gt;(in-package "UNIFY")&lt;/b&gt;
&lt;i&gt;#&amp;lt;The CL.EXT.DACF.UNIFICATION package, 326/512 internal, 20/64 external&amp;gt;&lt;/i&gt;

UNIFY 4 &amp;gt; &lt;b&gt;(unify #T(regexp "a(b+)c(d+)" (?bs ?ds)) "abbbbcddd")&lt;/b&gt;
&lt;i&gt;#&amp;lt;UNIFY ENVIRONMENT: 1 frame 200BC147&amp;gt;&lt;/i&gt;

UNIFY 5 &amp;gt; &lt;span style="font-weight:bold;"&gt;(v? '?bs *)&lt;/span&gt;
&lt;span style="font-style:italic;"&gt;"bbbb"
T&lt;/span&gt;

UNIFY 6 &amp;gt; &lt;span style="font-weight:bold;"&gt;(v? '?ds **)&lt;/span&gt;
&lt;span style="font-style:italic;"&gt;"ddd"
T&lt;/span&gt;
&lt;/pre&gt;

Of course, the other matching operations work as expected.

&lt;pre&gt;
UNIFY 9 &amp;gt; &lt;span style="font-weight:bold;"&gt;(match-case ("abbbbcdd")
                      (#T(regexp "a(b+)c(d+)" (?bs ?ds)) (concatenate 'string ?ds ?bs))
                      (t "It did not work!"))&lt;/span&gt;
&lt;span style="font-style:italic;"&gt;"ddbbbb"&lt;/span&gt;
&lt;/pre&gt;

I.e., there is an interface to get to the actual regexp groups (beyond those available directly in CL-PPCRE).

Maybe the syntax of the regexp unification templates could be made even more CL-PPCRE-like by exploiting "named registers", but, for the time being, the above is the best way to use it.

&lt;hr&gt;
(cheers)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-1000802114857209919?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/1000802114857209919/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2009/04/cl-unification-does-regexps-thanks-to.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/1000802114857209919'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/1000802114857209919'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2009/04/cl-unification-does-regexps-thanks-to.html' title='CL-UNIFICATION does regexps (thanks to Edi Weitz)'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-5285579309699055472</id><published>2009-03-27T06:29:00.000-07:00</published><updated>2009-03-27T06:45:03.169-07:00</updated><title type='text'>Maybe a bug?  Some considerations.</title><content type='html'>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;I just bumped into this while trying to load &lt;a href="http://common-lisp.net/projects/mel-base"&gt;MEL-BASE&lt;/a&gt; into LW.  The library has a file 'environment.lisp' which contains the following code.

&lt;pre&gt;
&lt;span style="color: green"&gt;#+openmcl&lt;/span&gt;
(defun gethostname ()
  "Returns the hostname"
  (ccl::%stack-block ((resultbuf 256))  
    (if (zerop (&lt;span style="color: red"&gt;#_gethostname&lt;/span&gt; resultbuf 256))
      (ccl::%get-cstring resultbuf)
      (error "gethostname() failed."))))
&lt;/pre&gt;

As we know, OpenMCL, its predecessors, and its successors, define &lt;tt&gt;#_&lt;/tt&gt; as areader macro to call up system functions.&lt;/p&gt;

Now, LW (M 5.x) barfs on this, because it tries to &lt;code&gt;READ&lt;/code&gt; the &lt;code&gt;DEFUN&lt;/code&gt; in order to discard it.

&lt;p&gt;I do not know if this is a bug or not (I have not checked), but it reinforced my preference for code organization, where I relegate implementation dependencies in separate files.  I.e., I do not write a file like 'foo.lisp' and pepper it with a lot of &lt;code&gt;#+&lt;/code&gt;, &lt;code&gt;#-&lt;/code&gt;.  I would relegate such system dependencies in a &lt;code&gt;ccl.lisp&lt;/code&gt; (or a &lt;code&gt;cmucl.lisp&lt;/code&gt;) file, and I would conditionally include the file in the &lt;tt&gt;.asd&lt;/tt&gt; or &lt;tt&gt;.system&lt;/tt&gt; file.  This way I feel I have more control over system dependencies, and I do not incur in snag like the &lt;code&gt;#_&lt;/code&gt; one.&lt;/p&gt;

&lt;hr&gt;

&lt;p&gt;
(cheers)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-5285579309699055472?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/5285579309699055472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2009/03/maybe-bug-some-considerations.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/5285579309699055472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/5285579309699055472'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2009/03/maybe-bug-some-considerations.html' title='Maybe a bug?  Some considerations.'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-9571402611445434</id><published>2009-02-26T05:43:00.000-08:00</published><updated>2009-02-26T05:53:59.172-08:00</updated><title type='text'>Lazily cleaning up....</title><content type='html'>&lt;p&gt;I just cleaned up a bit the &lt;a href="http://common-lisp.net/project/clazy"&gt;CLAZY&lt;/a&gt; library.   Things are tidier in the implementation, obvious bugs have been swatted away and the web site is more informative (although by no means complete).  A big thank goes to Theam Yong Chew, Joshua Taylor and Raffael Cavallaro for ideas and testing.  Some more extensions are in the pipeline...&lt;/p&gt;



(cheers)&lt;br /&gt;
&lt;hr&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-9571402611445434?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/9571402611445434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2009/02/lazily-cleaning-up.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/9571402611445434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/9571402611445434'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2009/02/lazily-cleaning-up.html' title='Lazily cleaning up....'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-8454261541214305109</id><published>2009-02-19T07:56:00.000-08:00</published><updated>2009-02-19T09:16:54.067-08:00</updated><title type='text'>Feeling lazy....</title><content type='html'>&lt;p&gt;In my bouts of "other higher programming language envy" (no SLDJs), I wandered the realm of &lt;span style="font-style: italic;"&gt;lazy evaluation&lt;/span&gt;.  The results are being slowly collected in the &lt;a href="http://common-lisp.net/project/clazy"&gt;CLAZY&lt;/a&gt; library.  In principle it is not difficult to write up a lazy library in Common Lisp.  What is difficult is the balancing act you want to achieve in making your library work nicely with and within the language.  My choice has been to concentrate on the function &lt;span style="font-style: italic;"&gt;call point&lt;/span&gt; by providing an explicit extra call operator patterned after &lt;span style="font-family:courier new;"&gt;funcall&lt;/span&gt;.  The result is &lt;span style="font-family:courier new;"&gt;lazy:call&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;This has a number of nice consequences w.r.t. re-defining each of your lazy functions as macros (which is another implementation strategy).  The foremost is that lazy calls (which, let's remember, are the exception and not the rule in a strict language like Common Lisp) are clearly marked.  Let's see a simple example.  A function which chooses the first of its non-null 4 arguments and returns 0, 1, 2, or 3.  A call in strict Common Lisp could be:
&lt;/p&gt;&lt;pre&gt;
&lt;span style="font-family:courier new;"&gt;cl-prompt&gt; &lt;span style="font-weight: bold;"&gt;(choose4 nil nil t t)&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-style: italic;font-family:courier new;" &gt;2&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;
Using CLAZY, the same function called lazily would appear in expressions like the following ones.

&lt;/p&gt;&lt;pre&gt;
&lt;span style="font-family:courier new;"&gt;cl-prompt&gt; &lt;span style="font-weight: bold;"&gt;(lazy:call #'choose4 nil t nil t)&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-style: italic;font-family:courier new;" &gt;1&lt;/span&gt;

&lt;span style="font-family:courier new;"&gt;cl-prompt&gt; &lt;span style="font-weight: bold;"&gt;(lazy:call #'choose4 nil nil t (loop (print 42)))&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-style: italic;font-family:courier new;" &gt;2&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;
The lazy call is clearly marked.  An alternative would be to define special syntax to mark lazy calls.  Something like:
&lt;/p&gt;&lt;pre&gt;
&lt;span style="font-family:courier new;"&gt;cl-prompt&gt; &lt;span style="font-weight: bold;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;{&lt;/span&gt;choose4 nil nil t (loop (print 42))&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-style: italic;font-family:courier new;" &gt;2&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;
But I don't like to highjack parenthesis syntax (more on this subject later; note that there are no reader macros defined in CLAZY).  If I need to improve my self-esteem I can always start &lt;a href="http://xach.livejournal.com/142524.html"&gt;progamming in Perl&lt;/a&gt;.  Besides, given the CLAZY implementation, it is easy to do something like the following.
&lt;/p&gt;&lt;p&gt;
&lt;/p&gt;&lt;pre&gt;
&lt;span style="font-family:courier new;"&gt;cl-prompt&gt; &lt;span style="font-weight: bold;"&gt;(lazy:slacking&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold;font-family:courier new;" &gt;              (choose4 nil nil t (loop (print 42))))&lt;/span&gt;
&lt;span style="font-style: italic;font-family:courier new;" &gt;2&lt;/span&gt;

&lt;span style="font-family:courier new;"&gt;cl-prompt&gt; &lt;span style="font-weight: bold;"&gt;(lazy:lazily&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-weight: bold;font-family:courier new;" &gt;              (choose4 nil t (loop (print 42)) t))&lt;/span&gt;
&lt;span style="font-style: italic;font-family:courier new;" &gt;1&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;
&lt;code&gt;slacking&lt;/code&gt; and &lt;code&gt;lazily&lt;/code&gt; are &lt;code&gt;block&lt;/code&gt;-like macros (they do expand into a &lt;code&gt;block&lt;/code&gt;) and do exactly the same thing: all lazy functions are &lt;span style="font-family:courier new;"&gt;lazy:call&lt;/span&gt;ed within the scope.&lt;/p&gt;

&lt;p&gt;How is the choose4 function written?  Like this:
&lt;/p&gt;&lt;pre&gt;
&lt;span style="font-family:courier new;"&gt;(&lt;span style="color: rgb(255, 0, 0);"&gt;deflazy&lt;/span&gt; choose4 (e0 e1 e2 e3)&lt;/span&gt;
&lt;span style="font-family:courier new;"&gt;   (or e0 e1 e2 e3))&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;
The &lt;span style="font-family:courier new;"&gt;deflazy&lt;/span&gt; macro defines both strict and lazy versions of a function.  The &lt;span style="font-family:courier new;"&gt;def-lazy-function&lt;/span&gt; macro defines only the lazy version, which allows you to write
&lt;/p&gt;&lt;pre&gt;
&lt;span style="font-family:courier new;"&gt;(&lt;span style="color: rgb(255, 0, 0);"&gt;def-lazy-function&lt;/span&gt; cons (car cdr) ...) &lt;span style="color: rgb(51, 51, 255);"&gt;; You don't want to know... yet.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
So, where does this lead us?  To a nice Haskellesque library, where you can say (assume you are using the right packages).
&lt;/p&gt;&lt;pre&gt;
&lt;span style="font-family:courier new;"&gt;cl-prompt&gt; &lt;span style="font-weight: bold;"&gt;(take 4 (distinct (repeatedly 'random 64)))&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-style: italic;font-family:courier new;" &gt;(3 45 92 12)&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;
How does this work?  First of all, this last bit came out of a huge thread on C.L.L....  Second, I am too lazy now to tell you.  Just hang around and wait.&lt;/p&gt;

&lt;p&gt;
(cheers)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-8454261541214305109?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/8454261541214305109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2009/02/feeling-lazy.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/8454261541214305109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/8454261541214305109'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2009/02/feeling-lazy.html' title='Feeling lazy....'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-8130765439146006650</id><published>2009-02-17T02:17:00.000-08:00</published><updated>2009-02-17T02:26:51.331-08:00</updated><title type='text'>European Lisp Symposium 2009 in Milan, Italy</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_BeVKxhecdO8/SZqQOrJ3LYI/AAAAAAAAAAo/oXRdhiVrHa0/s1600-h/ELS2009logo.gif"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 174px; height: 135px;" src="http://2.bp.blogspot.com/_BeVKxhecdO8/SZqQOrJ3LYI/AAAAAAAAAAo/oXRdhiVrHa0/s320/ELS2009logo.gif" border="0" alt="" id="BLOGGER_PHOTO_ID_5303710092958838146" /&gt;&lt;/a&gt;

&lt;br /&gt;&lt;br /&gt;

&lt;p&gt;As noted elsewhere, I am the local organizing chair of the &lt;b&gt;2nd European Lisp Symposium&lt;/b&gt; (&lt;a href="http://european-lisp-symposium.org/"&gt;ELS2009&lt;/a&gt;) in Milan, Italy.  Registration will be open soon.&lt;/p&gt;

&lt;p&gt;(cheers)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-8130765439146006650?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/8130765439146006650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2009/02/european-lisp-symposium-2009-in-milan.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/8130765439146006650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/8130765439146006650'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2009/02/european-lisp-symposium-2009-in-milan.html' title='European Lisp Symposium 2009 in Milan, Italy'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_BeVKxhecdO8/SZqQOrJ3LYI/AAAAAAAAAAo/oXRdhiVrHa0/s72-c/ELS2009logo.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-6251796910385860645</id><published>2009-02-17T00:59:00.000-08:00</published><updated>2009-02-17T02:16:47.306-08:00</updated><title type='text'>Naming packages...</title><content type='html'>&lt;p&gt;In the years I developed a style of &lt;i&gt;package naming conventions&lt;/i&gt;.  It is heavily influenced by the Java hierarchical packages (and, let's remember, there are CL implementations that support hierarchical packages out there).  The style leverages CL &lt;i&gt;nicknames&lt;/i&gt; to achieve another interesting effect, which people may find useful: namely, it can alert the developer of different library implementations being loaded in the CL runtime.&lt;/p&gt;&lt;p&gt;Suppose I started working on a new library/system/application which I want to call &lt;code&gt;CLAMP&lt;/code&gt; (it has been in the works for ages). The name is simple enough, so I may start writing something like&lt;/p&gt;&lt;pre&gt;(defpackage "CLAMP" (:use "CL") ...
 (:export "MAKE-CLAMP" ...))
&lt;/pre&gt;&lt;p&gt;(Note that I prefer to use strings for names in packages; you may use keywords, which have some drawbacks or uninterned symbols like &lt;code&gt;#:clamp&lt;/code&gt;, but I'll comment on them in another post.)&lt;/p&gt;&lt;p&gt;Now, the name &lt;code&gt;CLAMP&lt;/code&gt; isn't particularly distinctive, so you may (it's a big "may") end up with clobbering your package space if you load in your running CL another &lt;code&gt;CLAMP&lt;/code&gt; package coming from elsewhere.&lt;/p&gt;&lt;p&gt;Since I learnt the Java lesson, I decide to rename my package in a more unique way as:&lt;/p&gt;&lt;pre&gt;(defpackage "IT.UNIMIB.DISCO.MA.CL.CLAMP" (:use "CL") ...
 (:nicknames "CLAMP")
 (:export "MAKE-CLAMP" ...))
&lt;/pre&gt;&lt;p&gt;The new package name &lt;code&gt;IT.UNIMIB.DISCO.MA.CL.CLAMP&lt;/code&gt; is rather unwieldy, so I added a nice nickname, &lt;code&gt;CLAMP&lt;/code&gt;, which is what I wanted to use as the &lt;i&gt;advertised name&lt;/i&gt; of my library.  These choices have a few - at first seemingly fortuitous, but subsequently intended - consequences.&lt;/p&gt;&lt;p&gt;First of all, suppose that I have a different (older) version of my library floating around.  Suppose also that in this version I have a terribly inefficient implementation of &lt;code&gt;MAKE-CLAMP&lt;/code&gt;.  My different version lives in a package named &lt;code&gt;EDU.NYU.CS.MARCO.COMMON-LISP.CLAMP&lt;/code&gt; which also has the &lt;code&gt;CLAMP&lt;/code&gt; nickname.  When I try, willingly or inadvertently, to load both packages in the CL runtime, an error is signalled (*), thus alerting me of a naming conflict, which, in this case would also lead to more inefficient code.&lt;/p&gt;&lt;p&gt;So my recipe for &lt;em&gt;naming packages&lt;/em&gt; is the following.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Choose a &lt;em&gt;unique enough&lt;/em&gt; package name, maybe following the Java hierarchical scheme.&lt;/li&gt;&lt;li&gt;Add the &lt;em&gt;advertised name&lt;/em&gt; of your package (or library) as a &lt;em&gt;nickname&lt;/em&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;(cheers)
&lt;/p&gt;
&lt;hr /&gt;&lt;p&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;(*) Most implementations I know of do signal a &lt;/span&gt;&lt;code&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;package-error&lt;/span&gt;&lt;/code&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;.  However, the ANSI spec is silent on the subject.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-6251796910385860645?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/6251796910385860645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2009/02/naming-packages.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/6251796910385860645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/6251796910385860645'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2009/02/naming-packages.html' title='Naming packages...'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1175266939384385294.post-6997785268196831906</id><published>2009-02-16T08:33:00.000-08:00</published><updated>2009-02-16T08:43:09.976-08:00</updated><title type='text'>Here I am....</title><content type='html'>Recently I read somewhere that there are so many blogs that nobody has the time to read any of them.  So, if you are here chances are you have not started blogging yourself....&lt;div&gt;
&lt;/div&gt;&lt;div&gt;This is a blog about the cult I follow (or the minority I belong to, to paraphrase film director Nanni Moretti) and about little bits and pieces of code I write while I should be doing something else.  I.e., this is a blog about Lisp (Common Lisp in particular) and other programming issues I find interesting.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;'(cheers)&lt;/div&gt;&lt;div&gt;--&lt;/div&gt;&lt;div&gt;Marco&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1175266939384385294-6997785268196831906?l=within-parens.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://within-parens.blogspot.com/feeds/6997785268196831906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://within-parens.blogspot.com/2009/02/here-i-am.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/6997785268196831906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1175266939384385294/posts/default/6997785268196831906'/><link rel='alternate' type='text/html' href='http://within-parens.blogspot.com/2009/02/here-i-am.html' title='Here I am....'/><author><name>(marco antoniotti)</name><uri>http://www.blogger.com/profile/06513735748852658637</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_BeVKxhecdO8/SZmYfx3eDJI/AAAAAAAAAAM/RvdfWabovM8/S220/markosimpson.png'/></author><thr:total>1</thr:total></entry></feed>
