<?xml version="1.0"?>
<rss version="2.0">
<channel>
	<title>Planet Lisp</title>
	<link>http://planet.lisp.org/</link>
	<description>Planet Lisp</description>
	<language>en</language>


<item>
	<title>Nikodemus Siivola: Neat TYPEP Trick</title>
	<guid isPermaLink="true">http://random-state.net/log/2012-05-15-neat-typep-trick.html</guid>
	<link>http://random-state.net/log/2012-05-15-neat-typep-trick.html</link>
	
	<description>&lt;p&gt;How do you test if an object is a cons that has the desired symbol
in the car?&lt;/p&gt;

&lt;pre&gt;(typep x '(cons (eql :foo)))&lt;/pre&gt;

&lt;p&gt;Sure,&lt;/p&gt;

&lt;pre&gt;(and (consp x) (eq :foo (car x)))&lt;/pre&gt;

&lt;p&gt;is essentially just as short...&lt;/p&gt;

&lt;p&gt;I still find cons types neat, even if they're a nightmare when it
comes to type derivation, but that's a different matter. Some
nightmares aren't &lt;em&gt;all&lt;/em&gt; bad.&lt;/p&gt;</description>
	
	<pubDate>Tue, 15 May 2012 17:19:49 GMT</pubDate>
</item>

<item>
	<title>Jochen Schmidt: CLOS Class Naming</title>
	<guid isPermaLink="true">http://blog.codeartist.org/2012/05/clos-class-naming.html</guid>
	<link>http://blog.codeartist.org/2012/05/clos-class-naming.html</link>
	
	<description>&lt;p&gt;The classes of the Common Lisp spec, the MOP and big CLOS projects like CLIM use some naming conventions which may not make sense at first. I'm speaking of the STANDARD- and BASIC- prefixes. What is the idea behind them? &lt;/p&gt; &lt;h2&gt;Protocol Oriented Programming&lt;/h2&gt; &lt;p&gt;In CLOS one defines "protocols" using classes and generic functions. Remember: Methods do belong to generic functions and not to classes. There are no dedicated means to define protocols - it is idiomatic. A common practice is to define "protocol classes" which often do not have any slots at all. They serve as superclasses to all classes which implement the protocol.  &lt;h2&gt;Basics and Standards&lt;/h2&gt;&lt;p&gt;In the set of protocol implementation classes there may be one, which contains a minimal complete implementation and/or there might be one which is something like the default implementation. Assuming a protocol for FOOBAR defined through the protocol-class FOOBAR the minimal implementation could be called BASIC-FOOBAR and the default one STANDARD-FOOBAR. The BASIC-** one if often called FUNDAMENTAL-** too. &lt;/p&gt; &lt;h2&gt;Extensibility&lt;/h2&gt;&lt;p&gt;It is often a good idea to implement STANDARD-** by inheriting the BASIC-** implementation, overriding the necessary parts. A protocol user who wants to implement his own implementation can decide on which level he wants to get in: He could inherit from STANDARD-** if his implementations is only a small variant. He may inherit from BASIC-** if the implementation is more complicated and perhaps incompatible to what STANDARD-** does. If even BASIC-** is to strict, he could try to implement the protocol class completely on its own - but this is then more like implementing interfaces in classical object oriented languages, where you cannot inherit behaviour at all. You have to provide methods for any necessary generic function the protocol is made of. This is the most work and implementing a protocol is often more than just following the interfaces. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/1909618888300962869-183108218182412754?l=blog.codeartist.org" alt="" /&gt;&lt;/div&gt;</description>
	
	<pubDate>Tue, 15 May 2012 09:59:00 GMT</pubDate>
</item>

<item>
	<title>Nikodemus Siivola: Trolled</title>
	<guid isPermaLink="true">http://random-state.net/log/2012-05-15-trolled.html</guid>
	<link>http://random-state.net/log/2012-05-15-trolled.html</link>
	
	<description>&lt;pre&gt;(set-macro-character #\{ (lambda (s c) (read-delimited-list #\} s t)) nil)
(set-macro-character #\} (get-macro-character #\)) nil)&lt;/pre&gt;

&lt;p&gt;EDIT: &lt;em&gt;I'm not saying &lt;a href="http://www.didierverna.com/sciblog/index.php?post/2012/05/14/Monday-Troll%3A-the-syntax-extension-myth"&gt;Didier&lt;/a&gt;
is wrong. He isn't. While readmacros are extremely flexible, the
system has some rather obvious shortcomings.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I'm just pointing out that making &lt;tt&gt;{foo}&lt;/tt&gt; read as list
is trivial in case someone walked away from his post with the
impression that it cannot be done.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If there's something I disagree with, it is his
characterization of readmacros as "shaky". Used to do things they can
do, in the manner they're designed to be used, they're perfectly
robust. Just not as nice or convenient as I would like them to
be.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The really interesting bit is his observation that
&lt;tt&gt;READ-DELIMITED-LIST&lt;/tt&gt; doesn't support dotted lists, which I
hadn't realized before. It isn't specified to, but it would be nice if
it did...&lt;/em&gt;&lt;/p&gt;</description>
	
	<pubDate>Tue, 15 May 2012 05:36:46 GMT</pubDate>
</item>

<item>
	<title>Slava Shirokov: CLOS FSM with MOP Sauce</title>
	<guid isPermaLink="true">http://sshrkv.tumblr.com/post/23090889739</guid>
	<link>http://sshrkv.tumblr.com/post/23090889739</link>
	
	<description>&lt;p&gt;Common Lisp in the desire to be as cool as possible includes in its specification the Common Lisp Object System, or CLOS, which itself can be introspected and altered in great detail using the MetaObject Protocol, or MOP, as described in &lt;a href="http://www.amazon.com/gp/product/0262610744/ref=as_li_qf_sp_asin_tl?ie=UTF8&amp;tag=sshrkvisawsm-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0262610744"&gt;The Art of the Metaobject Protocol&lt;/a&gt;. Unfortunately, MOP didn&amp;#8217;t make it into the ANSI standard, but most implementations include MOP as it is described in the book, and a compatibility package &lt;a href="http://common-lisp.net/project/closer/closer-mop.html"&gt;:closer-mop&lt;/a&gt; (available in &lt;a href="http://www.quicklisp.org/"&gt;Quicklisp&lt;/a&gt;) makes using the symbols described seamless between implementations.&lt;/p&gt;

&lt;p&gt;One of the features of MOP is the ability to make an instance of a CLOS class funcallable, that is allow a class instance to be a valid first argument to &lt;a href="http://www.lispworks.com/documentation/HyperSpec/Body/f_funcal.htm"&gt;funcall&lt;/a&gt;. This behavior in a lot of ways can resemble the traditional method model from other languages, but that&amp;#8217;s not how I intend use it here.&lt;/p&gt;

&lt;h3&gt;The Idea&lt;/h3&gt;

&lt;p&gt;I&amp;#8217;m going to show and tell an implementation of a generic &lt;a href="http://en.wikipedia.org/wiki/Finite-state_machine"&gt;finite state machine&lt;/a&gt; that uses the MOP concepts of &lt;code&gt;funcallable-standard-object&lt;/code&gt; and &lt;code&gt;funcallable-standard-class&lt;/code&gt; to marshal the flow of incoming events to the machine and the concept of CLOS generic method dispatch to handle the execution of transition handlers for any given state of the machine.&lt;/p&gt;

&lt;p&gt;These features will allow us to build a structure that lets us focus solely on the problem at hand and defer features like event data binding, state-dependent method selection and unexpected state handling entirely to the language without pushing the boundaries of any specific feature.&lt;/p&gt;

&lt;h3&gt;The Design&lt;/h3&gt;

&lt;p&gt;The design we&amp;#8217;re going for is such that we can define a class with a &lt;code&gt;state&lt;/code&gt; slot that will hold &lt;code&gt;:keyword&lt;/code&gt; name of a state. We&amp;#8217;ll make instances of this class funcallable so that when we make an instance we will be able to simply &lt;code&gt;(funcall fsm-instance fsm-evemt)&lt;/code&gt; repeatedly and have the machine dispatch to the correct event, perform any logic, and transition to the next state based on the input.&lt;/p&gt;

&lt;p&gt;We would be able to query the state of the machine with &lt;code&gt;(state fsm-instance)&lt;/code&gt; and receive a keyword, and we should be able to drive events into the machine until we&amp;#8217;re in a desired or unexpected state. Any attempt to feed the machine an event while the machine is in an invalid state should result in an error.&lt;/p&gt;

&lt;!-- more --&gt;

&lt;h3&gt;Setup&lt;/h3&gt;

&lt;p&gt;Dependencies in Common Lisp these days should come from &lt;a href="http://www.quicklisp.org/"&gt;Quicklisp&lt;/a&gt;. Install it now before even reading the next paragraph, and during the installation phase ask it to write itself to your lisp configuration&amp;#8217;s init file.&lt;/p&gt;

&lt;p&gt;The code samples below, as should any code using MOP intending to run more than once, uses the &lt;a href="http://common-lisp.net/project/closer/closer-mop.html"&gt;:closer-mop&lt;/a&gt; package. Fetch it from Quicklisp before attempting these examples by evaluating:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;(ql:quickload :closer-mop)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;At the REPL before attempting to evaluate any example code.&lt;/p&gt;

&lt;h3&gt;Implementation&lt;/h3&gt;

&lt;p&gt;We&amp;#8217;ll first declare the base of our state machine. We&amp;#8217;ll call the base &lt;code&gt;standard-state-machine&lt;/code&gt; to follow the convention CL seems to have of sticking the &lt;code&gt;standard-&lt;/code&gt; prefix to base classes.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(defclass standard-state-machine (c2mop:funcallable-standard-object)
  ((state :initform :initial :initarg :state
          :accessor state)
   (last-event :initform (get-internal-real-time)
               :accessor last-event))

  (:metaclass c2mop:funcallable-standard-class))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This grants us the majority of our desired features from the design. The resulting class holds a &lt;code&gt;:keyword&lt;/code&gt; state name in a &lt;code&gt;state&lt;/code&gt; slot, and is declared to be funcallable by the inclusion of the &lt;code&gt;funcallable-standard-object&lt;/code&gt; base and the &lt;code&gt;funcallable-standard-class&lt;/code&gt; &lt;a href="http://en.wikipedia.org/wiki/Metaclass"&gt;metaclass&lt;/a&gt; for the class itself.&lt;/p&gt;

&lt;p&gt;When events fire through this state machine we will need to invoke a method that we can use to dispatch to various handlers in the machine depending on the state we happen to be in. We can use the CLOS generic method feature called &lt;strong&gt;eql specializers&lt;/strong&gt; to distinguish which method should be invoked based on the name of the state a machine happens to be in. EQL specializers are just like type specializers for method parameters, but instead of the comparison of the parameter to the specialization happening based on the type of the parameter, it happens as if an &lt;code&gt;(eql parameter-value parameter-specialization)&lt;/code&gt; test is performed to determine if a given method is applicable to an invocation.&lt;/p&gt;

&lt;p&gt;With this in mind we can design a generic method that is aware of three things as parameters that we can choose to specialize: The current state machine, the state of the current state machine, and the event that was received by the machine.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(defgeneric standard-state-machine-event (machine state event))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We won&amp;#8217;t define any such methods now, because right now we have no state machine to model, and as such have no state handing methods to define.&lt;/p&gt;

&lt;p&gt;To actually invoke a function when the funcallable instance is called as a function a lambda must be bound to be the &lt;em&gt;funcallable instance function&lt;/em&gt; of a given instance of a class. Since there is no mandate for an inherent &lt;em&gt;this&lt;/em&gt; pointer in CL, the best place to bind this function is often in one of the specializations of &lt;code&gt;initialize-instance&lt;/code&gt; and close over the current instance in the process. The attachment of a function to an instance is done with the MOP function &lt;code&gt;set-funcallable-instance-function&lt;/code&gt;, which places no special requirements on the args list of the attached function.&lt;/p&gt;

&lt;p&gt;We&amp;#8217;ll bind our driver to the state machine instance in the &lt;code&gt;:before&lt;/code&gt; specializer of its &lt;code&gt;initialize-instance&lt;/code&gt; method, and use an args list that expects only the &lt;code&gt;event&lt;/code&gt; that is being delivered to the state machine:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(defmethod initialize-instance :before ((machine standard-state-machine) &amp;amp;key)
  (c2mop:set-funcallable-instance-function
   machine
   #'(lambda (event)
       (multiple-value-bind (next-state recur-p)
           (standard-state-machine-event machine (state machine) event)

         (setf (last-event machine) (get-internal-real-time)
               (state machine) (or next-state (state machine)))

         (if recur-p
             (funcall machine event)
             (values machine (state machine)))))))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now when we have instance of the state machine invoked with &lt;code&gt;(funcall fsm-instance event)&lt;/code&gt;, the inner &lt;code&gt;lambda&lt;/code&gt; expression will get passed the event and compute a return. This function despite having some length does very little.&lt;/p&gt;

&lt;p&gt;First, it dispatches the event to our previous &lt;code&gt;standard-state-machine-event&lt;/code&gt; method using the instance of the state machine we closed over as the first parameter, the state of the state machine as the second parameter and the event that the machine was called with.&lt;/p&gt;

&lt;p&gt;It expects a multi-value return, but if the method only returns one value, no error is raised and the second value, &lt;code&gt;recur-p&lt;/code&gt; is left bound to nil. Its meaning will become abundant in a moment.&lt;/p&gt;

&lt;p&gt;Once the state handler is called the new state returned by the handler is stored as the current state of the state machine, and if a second value was returned, the machine is invoked again with the same event it had just received before returning from the handler the value of the current machine instance for chaining and the value of the current state.&lt;/p&gt;

&lt;p&gt;The second, &lt;code&gt;recur-p&lt;/code&gt; value is a hook that can be used from a state handler to force the machine to retry handling the event in a new state. This is useful when the same event should loop through the machine a second time before the transition is complete, and the optional second value return from a state handler allows that without additional external plumbing.&lt;/p&gt;

&lt;p&gt;Functionally, the implementation of the state machine is complete. It can now cycle through a graph of events, provided that those events are defined as specialized methods. But, in its current state, the API leaves very much to be desired.&lt;/p&gt;

&lt;h3&gt;The Polish&lt;/h3&gt;

&lt;p&gt;As the state machine stands now, to implement one that for all inputs remains in the default &lt;code&gt;:initial&lt;/code&gt; state, one would have to be defined explicitly by specializing the &lt;code&gt;standard-state-machine&lt;/code&gt; event.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(defmethod standard-state-machine-event
            ((fsm standard-state-machine)
             (state (eql :initial))
             event)
  nil)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The trailing nil makes the return value explicit, due to the length of the specializations. This makes the structure of the dispatch clear, and the nil return value could be traced through the driver above to determine that this machine would do absolutely nothing given any kind of input. Remaining eternally in the &lt;code&gt;:initial&lt;/code&gt; state.&lt;/p&gt;

&lt;p&gt;To make the task of defining states for a given type of state machine we can write a simple macro to write the above form for us. After all, the majority of it is filler.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(defmacro defstate (machine-type state-name (machine-sym event-sym) &amp;amp;body body)
  `(defmethod standard-state-machine-event
       ((,machine-sym ,machine-type) (state (eql ,state-name)) ,event-sym)
     ,@body))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Using the macro above we can now declare an identical looping &lt;code&gt;:initial&lt;/code&gt; state for the standard-state-machine as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(defstate standard-state-machine :initial (fsm event)
  nil)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Which results in identical code to the one we wrote previously. The symbols given in the argument list of the &lt;code&gt;defstate&lt;/code&gt; forms are bound to the machine evaluating the event and the event that is being sent through the machine. The remaining forms will be evaluated just as in any other defun/defmethod with the return value treated as either next state for the machine to enter, nil to stay in the same state, or a multivalue return with one of the previous and a non-nil second value to indicate the event should be fired through the machine a second time before the final state is stored.&lt;/p&gt;

&lt;p&gt;To create subclasses of the standard state machine, we again run into a similar situation as before with boilerplate requirements. Each subclass of &lt;code&gt;standard-state-machine&lt;/code&gt; must not only include the &lt;code&gt;standard-state-machine&lt;/code&gt; class in the list of parents, it must also include &lt;code&gt;funcallable-standard-class&lt;/code&gt; as its metaclass, as in:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(defclass my-fsm (standard-state-machine)
  ()
  (:metaclass c2mop:standard-funcallable-class))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This peculiarity could be documented a thousand times in a thousand places, but that will make it no less ugly or difficult to remember. It would be much easier to provide a familiar tasting API to consumers that results in the same code. For example, using a structure like this to generate code equivalent to the above&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(deffsm my-fsm ()
  ())
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This leaves the consumer free to do whatever their heart desires with CLOS without disturbing the requirements of our function. Such a construct can be stated simply as another tiny macro.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(defmacro deffsm (name parents slots &amp;amp;rest options)
  `(defclass ,name ,(append (list 'standard-state-machine) parents)
     ,slots
     (:metaclass c2mop:funcallable-standard-class)
     ,@options))
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;The Result&lt;/h3&gt;

&lt;p&gt;If we were to put all of that code together in one place with a bunch of documentation strings for the methods, classes and slots in a slightly more condensed form than this article, it might look something &lt;a href="https://gist.github.com/2698150"&gt;like this&lt;/a&gt;. Which is actually a &lt;a href="https://github.com/sshirokov/hinge/blob/68c73767d962e21a5f128de2309d78aa1da66eea/src/http/fsm.lisp"&gt;minimal extraction&lt;/a&gt; of the state machine that drives the &lt;a href="https://github.com/sshirokov/hinge/blob/68c73767d962e21a5f128de2309d78aa1da66eea/src/http/parser.lisp"&gt;HTTP parser&lt;/a&gt; in &lt;a href="https://github.com/sshirokov/hinge"&gt;Hinge&lt;/a&gt;. If this article gets enough interest, I will extract &lt;code&gt;standard-state-machine&lt;/code&gt; into a QuickLisp compatible package for even easier reuse.&lt;/p&gt;

&lt;h3&gt;The Demo&lt;/h3&gt;

&lt;p&gt;Let&amp;#8217;s construct an FSM for determining if a sequence of characters contains the string &amp;#8220;Hi&amp;#8221;, but before the character &amp;#8220;!&amp;#8221; appears. Once a string contains &amp;#8220;Hi&amp;#8221; it can contain &amp;#8220;!&amp;#8221; characters again.&lt;/p&gt;

&lt;p&gt;We&amp;#8217;ll model this as a machine of three states, with events being single characters of input. The states will be &lt;code&gt;:initial&lt;/code&gt;, &lt;code&gt;:want-i&lt;/code&gt; and &lt;code&gt;:done&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;:initial&lt;/code&gt; state, we&amp;#8217;ll accept any input without transitioning except for &amp;#8220;!&amp;#8221; which will cause the machine to transition into an error state so that no more input can pass, and &amp;#8220;H&amp;#8221; will cause the machine to transition to the &lt;code&gt;:want-i&lt;/code&gt; state.&lt;/p&gt;

&lt;p&gt;Any event other than &amp;#8220;i&amp;#8221; in the &lt;code&gt;:want-i&lt;/code&gt; state will transition back to &lt;code&gt;:initial&lt;/code&gt; and the event &amp;#8220;i&amp;#8221; will cause the machine to enter the state &lt;code&gt;:done&lt;/code&gt;, which will be a no-op looping state that allows input to pass through uninspected. The implementation for such a machine would look like &lt;a href="https://gist.github.com/2699337"&gt;this&lt;/a&gt;, assuming we have previously defined the &lt;a href="https://gist.github.com/2698150"&gt;:fsm package&lt;/a&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(fsm:deffsm hi-fsm ()
  ())

(fsm:defstate hi-fsm :initial (fsm c)
  (case c
    (#\! :error)
    (#\H :want-i)))

(fsm:defstate hi-fsm :want-i (fsm c)
  (if (char-equal c #\i)
      :done
      (values :initial t)))

(fsm:defstate hi-fsm :done (fsm c)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We can observe it in action by running it through a couple of strings and measuring the terminal state of the machine:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(let ((fsm (make-instance 'hi-fsm))
       (input "Oh? Hello there. Hi. How are you!?"))
  (map 'list 
       (lambda (c) 
         (if (eql :error (fsm:state fsm))
             (format t "Skipping: ~S~%" c)
             (funcall fsm c))) 
       input)
  (fsm:state fsm))
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Resulting in &lt;code&gt;:DONE&lt;/code&gt; as the final state of &lt;code&gt;hi-fsm&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This will iterate the string character by character through the machine we just defined, and unless the machine is in an error state, it will submit each token, then return the state of the machine when it has completed its run.&lt;/p&gt;

&lt;p&gt;If we change the string to one where neither &amp;#8220;Hi&amp;#8221; nor &amp;#8220;!&amp;#8221; appear at all, the machine will remain in &lt;code&gt;:initial&lt;/code&gt; and if &amp;#8220;!&amp;#8221; appears before &amp;#8220;Hi&amp;#8221;, then the machine will leave the loop in an &lt;code&gt;:error&lt;/code&gt; state, and any tokens after the &amp;#8220;!&amp;#8221; won&amp;#8217;t even be sent into the machine. Changing the binding of &lt;code&gt;input&lt;/code&gt; in the  above to &amp;#8220;Go away! Now.&amp;#8221; results in the value of &lt;code&gt;:ERROR&lt;/code&gt; and the printing of the lines&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Skipping: #\ 
Skipping: #\N
Skipping: #\o
Skipping: #\w
Skipping: #\.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So there you have it. You now know how to leverage the powers of Common Lisp and MOP to build a pretty cool and useful abstraction for a pretty common algorithm.&lt;/p&gt;</description>
	
	<pubDate>Tue, 15 May 2012 05:33:00 GMT</pubDate>
</item>

<item>
	<title>Nicolas Martyanoff: Display images in Emacs from Common Lisp</title>
	<guid isPermaLink="true">http://wandrian.net/2012-05-14-2110-display-images-in-emacs-from-common-lisp.html</guid>
	<link>http://wandrian.net/2012-05-14-2110-display-images-in-emacs-from-common-lisp.html</link>
	
	<description>&lt;p&gt;The slime repl is used to interact with a Common Lisp process, and while printing textual information is good enough most of the time, being able to display an image can be really useful.&lt;/p&gt;
&lt;p&gt;I used to simply call an external process, the image viewer &lt;a href="http://feh.finalrewind.org"&gt;feh&lt;/a&gt;, but the following method is more interesting.&lt;/p&gt;
&lt;p&gt;You first need to load the &lt;code&gt;slime-media&lt;/code&gt; module which is provided with slime, for example by adding it to the list of modules to load with slime:&lt;/p&gt;
&lt;pre class="sourceCode commonlisp"&gt;&lt;code class="sourceCode commonlisp"&gt;(slime-setup '(slime-repl
               slime-asdf
               slime-fuzzy
               slime-banner
               slime-indentation
               slime-media))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You then have to authorize Slime to evaluate arbitrary lisp forms coming from the Common Lisp process:&lt;/p&gt;
&lt;pre class="sourceCode commonlisp"&gt;&lt;code class="sourceCode commonlisp"&gt;(&lt;span class="kw"&gt;setq&lt;/span&gt; slime-enable-evaluate-in-emacs &lt;span class="kw"&gt;t&lt;/span&gt;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let's display an image:&lt;/p&gt;
&lt;center&gt;
&lt;img src="http://wandrian.net/img/slime-images/slime-images.png" /&gt;
&lt;/center&gt;

&lt;p&gt;It looks pretty good, but I really wanted to have the return value printed below the image, and not on its right.&lt;/p&gt;
&lt;p&gt;The following function is a modification of &lt;code&gt;slime-media-insert-image&lt;/code&gt;; an end-of-line character is inserted just after the image. This way, the result value is printed below the image. Furthermore, when more than one image is displayed during the same call, it won't be crammed on the same line.&lt;/p&gt;
&lt;pre class="sourceCode commonlisp"&gt;&lt;code class="sourceCode commonlisp"&gt;(&lt;span class="kw"&gt;defun&lt;/span&gt;&lt;span class="fu"&gt; nm-slime-media-insert-image &lt;/span&gt;(image &lt;span class="kw"&gt;string&lt;/span&gt;)
  (with-current-buffer (slime-output-buffer)
    (&lt;span class="kw"&gt;let&lt;/span&gt; ((marker (slime-output-target-marker :repl-result)))
      (goto-char marker)
      (slime-propertize-region `(face slime-repl-result-face
                                      rear-nonsticky (face))
        (insert-image image &lt;span class="kw"&gt;string&lt;/span&gt;)
        (insert ?\n))
      &lt;span class="co"&gt;;; Move the input-start marker after the REPL result.&lt;/span&gt;
      (set-marker marker (point)))
    (slime-repl-show-maximum-output)))&lt;/code&gt;&lt;/pre&gt;</description>
	
	<pubDate>Mon, 14 May 2012 19:10:00 GMT</pubDate>
</item>

<item>
	<title>Didier Verna: Monday Troll: the syntax extension myth</title>
	<guid isPermaLink="true">http://www.didierverna.com/sciblog/index.php?post/2012/05/14/Monday-Troll%3A-the-syntax-extension-myth</guid>
	<link>http://www.didierverna.com/sciblog/index.php?post/2012/05/14/Monday-Troll%3A-the-syntax-extension-myth</link>
	
	<description>&lt;p&gt;Here's a little Monday Troll.&lt;/p&gt;


&lt;p&gt;To my greatest disappointment, I discovered today that it is not possible to replace Lisp parenthesis by, say, ... curly braces. What a shame. Hell, it's not even possible to freely mix the two. Very naively, I had expected that:&lt;/p&gt;
&lt;pre class="lisp lisp"&gt;&lt;span&gt;&amp;#40;&lt;/span&gt;set-macro-character #\&lt;span&gt;&amp;#123;&lt;/span&gt; &lt;span&gt;&amp;#40;&lt;/span&gt;get-macro-character #\&lt;span&gt;&amp;#40;&lt;/span&gt;&lt;span&gt;&amp;#41;&lt;/span&gt;&lt;span&gt;&amp;#41;&lt;/span&gt;
&lt;span&gt;&amp;#40;&lt;/span&gt;set-macro-character #\&lt;span&gt;&amp;#125;&lt;/span&gt; &lt;span&gt;&amp;#40;&lt;/span&gt;get-macro-character #\&lt;span&gt;&amp;#41;&lt;/span&gt;&lt;span&gt;&amp;#41;&lt;/span&gt;&lt;span&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;would suffice, but no. All implementations that I have tested seem to agree on this, although the error messages may differ. For instance, trying to evaluate &lt;code&gt;{and}&lt;/code&gt; gives you an "unmatched close parenthesis error"  except for CMU-CL which chooses to ignore it, but then report an end-of-file error. The unmatched close parenthesis, of course, is the closing curly brace! So what is going on here?&lt;/p&gt;


&lt;p&gt;When an opening curly brace is read, the original left paren macro function is called. In SBCL for instance, this is SB-IMPL::READ-LIST, which looks for a hardwired right paren on the stream. Yuck. It doesn't find one, but it finds my closing brace which triggers the "standalone" right paren behavior (spurious paren alert). In passing, it also surprised me that SB-IMPL::READ-LIST is not implemented in terms of READ-DELIMITED-LIST.&lt;/p&gt;


&lt;p&gt;EDIT: as mentioned in several comments, we could use &lt;code&gt;read-delimited-list&lt;/code&gt; to look for a closing curly brace, but even this won't work completely. The problem is with dotted lists (see Pascal's comment). SBCL hard-wires #\) in its dotted lists parsing procedures.&lt;/p&gt;


&lt;p&gt;So it appears that dispatching macro characters are only shaky. What we miss is a true concept of syntactic categories (Common Lisp character syntax types are close, but not quite there yet). In fact, TeX, with its notion of &lt;em&gt;catcodes&lt;/em&gt; (category codes), seems to be the only language that gets this right. Ideally, any character with associated status LIST TERMINATOR should do as good as a right paren (the problem is only with closing, not opening).&lt;/p&gt;


&lt;p&gt;Instead of hard-wiring the right paren in the Lisp parser, a quick workaround would be to check whether the next character on the stream is a dispatching one, and in such a case, whether its macro function is the one originally associated with the right paren. If so, it should then simply stand as a list terminator. This is actually an interesting idea I think: could the built-in macro functions become equivalent to actual category codes, and could we completely remove hard-wired characters in Lisp parsers?&lt;/p&gt;


&lt;p&gt;Anyway, this whole story is a true scandal because it ruined an otherwise cool live demo of mine. So much for syntax extensibility. I will immediately complain to the concerned authorities.
&lt;br /&gt;
&lt;br /&gt;&lt;/p&gt;


&lt;p&gt;&lt;em&gt;Looking for the concerned authorities to complain to... please wait.&lt;/em&gt;&lt;/p&gt;</description>
	
	<pubDate>Mon, 14 May 2012 00:00:00 GMT</pubDate>
</item>

<item>
	<title>Quicklisp news: Updates coming soon</title>
	<guid isPermaLink="true">http://blog.quicklisp.org/2012/05/updates-coming-soon.html</guid>
	<link>http://blog.quicklisp.org/2012/05/updates-coming-soon.html</link>
	
	<description>I usually like to update Quicklisp libraries on the first weekend of each month. A few things conspired to delay me this time around, but I hope to have updates published by this Sunday, May 13th.&lt;br /&gt;&lt;br /&gt;The coming update includes &lt;a href="http://version%200.10.7.1%20of%20cffi/"&gt;version 0.10.7.1 of CFFI&lt;/a&gt;, &lt;strike&gt;which has a handful of backwards-incompatible changes. For the most part, Quicklisp projects have been updated to fix compile-time problems with CFFI compatibility. There remains the possibility that some problems lurk that will only appear at runtime. If you work on a project that relies on CFFI, you may want to run it through its paces with the new version to make sure everything still works properly.&lt;/strike&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;update&lt;/b&gt;&amp;nbsp;I was wrong about the CFFI updates. There haven't been any backwards-incompatible changes from 0.10.6 to 0.10.7.1. Sorry for the confusion.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/966494149405077884-7812160649224158504?l=blog.quicklisp.org" alt="" /&gt;&lt;/div&gt;</description>
	
	<pubDate>Thu, 10 May 2012 15:40:00 GMT</pubDate>
</item>

<item>
	<title>Lispjobs: COMMON LISP/CLOS - Evergreen, Colorado USA</title>
	<guid isPermaLink="true">http://lispjobs.wordpress.com/2012/05/10/common-lispclos-evergreen-colorado-usa/</guid>
	<link>http://lispjobs.wordpress.com/2012/05/10/common-lispclos-evergreen-colorado-usa/</link>
	
	<description>&lt;p&gt;Secure Outcomes is looking for a hardcore Lisp developer with deep experience in Common Lisp/CLOS, image processing and artificial intelligence techniques, advanced cryptography, communications, GUI, and embedded real-time. Direct experience in electronic livescan fingerprint collection, archiving, and transmission, and/or crypto NIST certification is a distinct plus.&lt;/p&gt;
&lt;p&gt;Secure Outcomes is a venture funded closely-held Colorado company that designs and manufactures the very best electronic livescan fingerprint collection, lookup, and transmission systems available for the price.&lt;/p&gt;
&lt;p&gt;We design all of our systems at our headquarters facility in beautiful Evergreen, Colorado at an elevation of 7,200-feet in the foothills of the Rocky Mountains about 25-miles west of Denver.&lt;/p&gt;
&lt;p&gt;Secure Outcomes provides terrific opportunities for fiercely talented and driven people.&lt;/p&gt;
&lt;p&gt;Our systems combine advanced FBI-Certified fingerprint scan-head devices and super-compact 21st century low-power control electronics and display touchscreens with custom control and analysis software designed with the user in mind to yield the easiest to use, most capable, and most user-friendly systems on the market &amp;#8211; all in Lisp.&lt;/p&gt;
&lt;p&gt;Evergreen, Colorado, the home of Secure Outcomes, offers an extremely high-quality of life. World class skiing is just about an hour away at Keystone, Vail, Winter Park, and many others. Lake Evergreen offers excellent night/day ice skating and summer water sports/sailing. Mountain and touring biking and hiking abound during the summer months. In addition, Evergreen supports a thriving cultural community that includes the Evergreen Jazz Festival in the summer and the Evergreen Chorale and Evergreen Players for live music and theater year round. Evergreen has 300+ days of annual sunshine.&lt;/p&gt;
&lt;p&gt;Competitive salaries. Fully paid medical.&lt;/p&gt;
&lt;p&gt;See our products in action at&amp;nbsp;&lt;a href="http://www.youtube.com/watch?v=Ti2q8eK0l58" target="_blank"&gt;http://www.youtube.com/watch?v=Ti2q8eK0l58&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Resumes to&amp;nbsp;&lt;a href="mailto:lisp@secureoutcomes.net" target="_blank"&gt;lisp@secureoutcomes.net&lt;/a&gt;. No calls please.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.secureoutcomes.net/Employment.html" target="_blank"&gt;http://www.secureoutcomes.net/Employment.html&lt;/a&gt;&lt;/p&gt;
&lt;br /&gt;  &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lispjobs.wordpress.com/661/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lispjobs.wordpress.com/661/" /&gt;&lt;/a&gt; &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lispjobs.wordpress.com/661/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lispjobs.wordpress.com/661/" /&gt;&lt;/a&gt; &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lispjobs.wordpress.com/661/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lispjobs.wordpress.com/661/" /&gt;&lt;/a&gt; &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lispjobs.wordpress.com/661/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lispjobs.wordpress.com/661/" /&gt;&lt;/a&gt; &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lispjobs.wordpress.com/661/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lispjobs.wordpress.com/661/" /&gt;&lt;/a&gt; &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lispjobs.wordpress.com/661/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lispjobs.wordpress.com/661/" /&gt;&lt;/a&gt; &lt;a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lispjobs.wordpress.com/661/"&gt;&lt;img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lispjobs.wordpress.com/661/" /&gt;&lt;/a&gt; &lt;img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lispjobs.wordpress.com&amp;blog=504450&amp;post=661&amp;subd=lispjobs&amp;ref=&amp;feed=1" width="1" height="1" /&gt;</description>
	
	<pubDate>Thu, 10 May 2012 06:53:25 GMT</pubDate>
</item>

<item>
	<title>ECL News: Bug reports: please do them!</title>
	<guid isPermaLink="true">http://sourceforge.net/news/?group_id=30035&amp;id=307716</guid>
	<link>http://sourceforge.net/news/?group_id=30035&amp;id=307716</link>
	
	<description>I am sorry. Really, I am. I cannot follow you all in all your usual communication channels: comp.lang.lisp, the ecl forum, #lisp irc channel... But please consider this:&lt;br /&gt;&lt;br /&gt;First of all, ECL is maintained in free time. In this sense, it is more beneficial for you if the maintainers spend more time coding than trolling about lisp.&lt;br /&gt;&lt;br /&gt;Second, an IRC channel is not a place to look for support. Sourceforge offers you a bug reporting facility (&lt;a href="https://sourceforge.net/tracker/?group_id=30035"&gt;https://sourceforge.net/tracker/?group_id=30035&lt;/a&gt;), a feature request database (&lt;a href="https://sourceforge.net/tracker/?group_id=30035&amp;atid=398056"&gt;https://sourceforge.net/tracker/?group_id=30035&amp;amp;atid=398056&lt;/a&gt;), a mailing list (&lt;a href="http://news.gmane.org/gmane.lisp.ecl.general/"&gt;http://news.gmane.org/gmane.lisp.ecl.general/&lt;/a&gt;)...&lt;br /&gt;&lt;br /&gt;Response times are usually very fast, and only in the most difficult cases (it involves legacy code, requires some nonstandard architecture, etc), or when a release is on queue, does it takes longer.&lt;br /&gt;&lt;br /&gt;In particular, in order to ease your life, bug reporting and feature requests are *now* possible for people without an account in Sourceforge. This is an experiment and I will try to keep it that way as long as spammers allow. Please make good use of it.&lt;br /&gt;&lt;br /&gt;Finally, if you find something does not work the way you expect it, instead of spending a week on it and then complaining about it anywhere, just leave a message in any of those communication channels I mentioned above. It will be more productive for you and for the free software community in general.&lt;br /&gt;&lt;br /&gt;Ah, and before I forget it: a good bug report for ECL needs at least the following information: 1) platform information and operating system, 2) configuration options, 3) if it failed at configuration time, the log, 4) if it failed at build time (i.e. during "make") a log of that, 5) if it fails with a standard (quicklisp library), steps to reproduce it, 6) if it fails with your code, ideally some sample to reproduce it.</description>
	
	<pubDate>Wed, 09 May 2012 21:50:29 GMT</pubDate>
</item>

<item>
	<title>Slava Shirokov: Hinge -- v0.0.1</title>
	<guid isPermaLink="true">http://sshrkv.tumblr.com/post/22704481029</guid>
	<link>http://sshrkv.tumblr.com/post/22704481029</link>
	
	<description>&lt;a href="https://github.com/sshirokov/hinge/tree/v0.0.1"&gt;Hinge -- v0.0.1&lt;/a&gt;: &lt;p&gt;&lt;a href="https://github.com/sshirokov/hinge"&gt;Hinge&lt;/a&gt;, my Node.js inspired API for Common Lisp wrapping &lt;a href="https://github.com/sbryant/cl-ev"&gt;libev&lt;/a&gt; is finally to a state where I feel okay giving it a non-zero version.&lt;/p&gt;

&lt;p&gt;I've decided now would be a good milestone because the HTTP server functions, and has a set of &lt;a href="https://github.com/sshirokov/hinge/tree/v0.0.1#quickstart"&gt;exported APIs that let you reply to the requests it generates&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The quick set of terrible benchmarks I performed on the "Hello World!" example show me a requests/second throughput of 1500-2500 depending on the mood of &lt;a href="http://httpd.apache.org/docs/2.0/programs/ab.html"&gt;ab&lt;/a&gt; (and the state of the number of sockets available on localhost). I intend to run it through a more serious (and HTTP/1.1 supporting) tool in the future, but for now ab has convinced me that the decisions I've made so far have not been abysmal.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/sshirokov/hinge/tree/v0.0.1/examples"&gt;examples&lt;/a&gt; directory contains a bunch of example programs, or in the earlier cases, code snippets demonstrating various levels of functionality.&lt;/p&gt;

&lt;p&gt;In the near future, in addition to covering the issues in the &lt;a href="https://github.com/sshirokov/hinge/tree/v0.0.1#readme"&gt;README&lt;/a&gt;, adding additional polish, and any bugs or blatant performance issues that come up I would like at some point to add support for:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;HTTP Clients&lt;/li&gt;
&lt;li&gt;SSL Sockets and Servers&lt;/li&gt;
&lt;li&gt;SSL HTTP Servers and Clients&lt;/li&gt;
&lt;li&gt;Async wrappers around FS calls&lt;/li&gt;
&lt;li&gt;Websockets (&lt;a href="http://tools.ietf.org/html/rfc6455"&gt;RFC6455&lt;/a&gt;) support&lt;/li&gt;
&lt;li&gt;&lt;a href="http://mongrel2.org/"&gt;Mongrel2&lt;/a&gt; ZeroMQ handler support (through &lt;a href="https://github.com/galdor/m2cl"&gt;m2cl&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://mongrel2.org/"&gt;Mongrel2&lt;/a&gt; ZeroMQ protocol-compatible server&lt;/li&gt;
&lt;li&gt;SPDY Support (Somewhere down the list, maybe)&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Any feedback is welcome however way you want to deliver it to me. This initial version stands to serve as a basic starting point for the concepts I wanted to convey, the take on the core APIs I wanted to offer, and a proof of a series of related concepts and architectural decisions. It may (hopefully) be useful as a stable base for progress, rather than chasing an otherwise potentially unstable head.&lt;/p&gt;</description>
	
	<pubDate>Wed, 09 May 2012 06:10:16 GMT</pubDate>
</item>


</channel>
</rss>

