
An early Clojure implementation in Common Lisp - fogus
http://github.com/clojure/clojure/blob/da14d89c1936e9de6eacb9c12dd9e6a0d68a0829/src/lisp/clojure.lisp
======
cemerick
Note that, unless I'm mistaken, this is from when Clojure emitted Java and C#
_source_. Check out the * host* variable. AFAIK, CL never "hosted" a Clojure
runtime.

~~~
parenthesis
Yes, grepping for '(format t ' would seem to confirm this.

------
KC8ZKF
He had DotLisp, a Lisp on the CLR, before Clojure as well.

<http://dotlisp.sourceforge.net/dotlisp.htm>

[http://groups.google.com/group/comp.lang.lisp/msg/e31b38c8cc...](http://groups.google.com/group/comp.lang.lisp/msg/e31b38c8cc0e6a23)

------
jjames
I read the "early" as pre-release and thought someone was trying to re-
implement clojure in CL. I'm relieved.

What's the backstory on this, fogus? I've not read about a CL Clojure pre-
dating the JVM implementation. Was this just a prototype or was there a plan
to platform on CL at some point?

~~~
fogus
I believe (caveat emptor) that this was an early prototype.

------
jimbokun
I was looking for reader macros for recognizing {} as hash tables and [] as
vectors. To me, that is one of the biggest innovations in Clojure over Lisps
that came before, the expansion of the concept of S-expressions.

~~~
Xurinos
I am not a CL expert, but I was able to whip this up in short time (and I
sacrificed a little readability for brevity):

    
    
        (defun set-hash-values (hash pairs)
          (when pairs
            (setf (gethash (car pairs) hash) (cadr pairs))
            (set-hash-values hash (cddr pairs))))
    
        (defun in-place-hash (stream char)
          (declare (ignore char))
            `(let ((hash (make-hash-table)))
               (set-hash-values hash ',(read-delimited-list #\} stream t))
               hash))
    
        (set-macro-character #\{ #'in-place-hash)
        (set-syntax-from-char #\} #\))
    

But to be honest, I think this {} stuff is an abuse of the hash structure.
People are really looking to make quick anonymous classes/structs; you see
this all the time in the perl world, and now we get to see this abuse promoted
and propagated in Clojure. In that case, {} should really translate to a MOP-
generated anonymous class.

Also, you are stuck with the decision some developer made for your hash's
efficiency trade-offs. In my reader macro, I left things at make-hash-table
defaults, but that might not be appropriate for your situation. Do you want to
be able to read quickly from your hash in exchange for slow writes, or do you
want to be able to write quickly to the hash in exchange for slow reads?

On another note, the [] vector reader macro is much easier to create. I just
wanted to prove to myself that I could write {}. But this additional syntax is
annoying. In practice when programming Lisp, it is easy to slap in a bunch of
))))) until the right alternate parentheses highlights. Now I have to remember
to slap in ] and } at the right spots, leaving me with )]}]]}})) noise. Maybe
that is why CL's in-place vector syntax is #().

Anyway, I would hesitate to call {} and [] an innovation.

~~~
nickik
1.[], {}, #{} are not the innovation. 2\. The innovation is that they are on
the same level as lists. All the cool list stuff you can do with lists you can
do with all of the structures and you can add more yourself if you want. That
allows to write stuff really generic. 3\. If you don't like them use (vec ),
(map ) and so on. Only the most imported ones have syntax there are many data
structures.

P.S. Do you really finish up all your parans yourself???

~~~
sedachv
Here is how Common Lisp developers view the question of sequence interface
abstraction:

[http://groups.google.com/group/comp.lang.lisp/browse_thread/...](http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/f2065aa0d9fa5d00/84f067175c1d33e6)?

This discussion came up recently over the usage of Christophe Rhodes' generic
sequence protocol extension to CL. Pascal Costanza makes a good point about
the appropriateness of having an overly abstract interface tower, and I agree
with him.

------
francoisdevlin
Does anyone else feel like they're looking at baby pictures?

~~~
zachbeane
[http://www.informatimago.com/develop/lisp/small-cl-
pgms/aim-...](http://www.informatimago.com/develop/lisp/small-cl-
pgms/aim-8/aim-8.html)

~~~
fogus
I wonder what happened to Part 2?

~~~
fogus
I'll answer my own question. McCarthy states in _History of Lisp_ , "Part II
was never written but was intended to contain applications to computing with
algebraic expressions."

Here's hoping he gets around to writing it one day. :-)

------
bokchoi
I came across JFLI a Common-Lisp foreign-language interface to Java and was
surprised to find it was authored by Mr. Hickey. I wonder how his experience
with JFLI shaped Clojure.

<http://jfli.sourceforge.net/>

------
nickik
To experiment with the language Rich had Clojure Compiler in CL targeting C#
and Java.

Then he took time off work and wrote the Java bootstrap compiler.

