6 ms·
An early Clojure implementation in Common Lisp
- jjames 16y agoI 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 16y agoI believe (caveat emptor) that this was an early prototype.
- francoisdevlin 16y agoDoes anyone else feel like they're looking at baby pictures?
- zachbeane 16y agohttp://www.informatimago.com/develop/lisp/small-cl-pgms/aim-8/aim-8.html http://www.informatimago.com/develop/lisp/small-cl-pgms/aim-...
- alexk7 16y agoNow that's "early"! (The link above points to McCarthy texts from 1959 about Lisp)
- fogus 16y agoI wonder what happened to Part 2?
- fogus 16y agoI'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. :-)
- KC8ZKF 16y agoHe had DotLisp, a Lisp on the CLR, before Clojure as well. http://dotlisp.sourceforge.net/dotlisp.htm http://dotlisp.sourceforge.net/dotlisp.htm http://groups.google.com/group/comp.lang.lisp/msg/e31b38c8cc0e6a23 http://groups.google.com/group/comp.lang.lisp/msg/e31b38c8cc...
- jimbokun 16y agoI 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.
- francoisdevlin 16y agoPersonally, my money is on the seq abstraction. YMMV.
- jimbokun 16y agoThat is also an excellent choice. But I believe they are related, or at least complement each other, in the sense that all of the data structure literals implement seq. I do not think they would work as well as an extension for S-expressions, otherwise.
- Xurinos 16y agoI 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.
- cemerick 16y agoNote 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 16y agoYes, grepping for '(format t ' would seem to confirm this.
- bokchoi 16y agoI 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/ http://jfli.sourceforge.net/
- nickik 16y agoTo 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.