Mar 12, 2011clojure is different from prior lisps: ~ and ~@ instead of , and ,@ inside macros # suffix for auto-gensymed $vars inside macros commas are just whitespace to improve readability, and make java programmers feel at home
“All Clojure functions implement both the java.lang.Runnable interface and the java.util.concurrent.Callable interface. This makes it easy to execute them in new Java threads." http://java.ociweb.com/mark/clojure/article.html Holy crap.
but clojure doesn't support tail-call optimization. recur is used to recurse in tail position. Interesting tradeoff.
trampoline for mutual recursion.
defn supports destructuring. rest args are delimited by &, not dot.
:as keyword as an alternative name for destructured args, that's nifty.
Oh, to get optional args, use rest args and destructure! Clever. http://thinkrelevance.com/blog/2008/09/16/pcl-clojure-chapter-5.html via google: 'optional args in clojure'
submit: http://thinkrelevance.com/blog/2008/09/16/pcl-clojure-chapter-5.html Clojure doesn't have optional args because you can destructure the rest parameter Optional args in Clojure: destructure the rest parameter http://arclanguage.org/item?id=13895 [tag: publish] via google: 'optional args in clojure'
and keyword args using map binding: http://stuartsierra.com/2010/01/15/keyword-arguments-in-clojure but gahd this makes me want to poke my eyes out with a stick: http://stackoverflow.com/questions/717963/clojure-keyword-arguments/3969693#3969693
If you're working in clojure, resist the temptation to recreate arc in it first-up. Use it for a while, see what you need.
“I'm sort of a Common Lisp guy. I'm not a Scheme guy..
Clojure's a Lisp-1. It's lexically scoped. However, it has dynamic variables, which behave a lot like in Common Lisp, except they have threading semantics.
It's a case-sensitive language." http://clojure.googlegroups.com/web/clojure-for-lispers-transcript.txt
Sold in six sentences.
I dislike some conventions, like using square brackets for lists that are not calls.
All primitives are generic. Yay!
No improper lists. Whoa. No dot?!
“You cannot be concerned about ephemeral consing any more. It's a real design misfeature to prioritize that."
Primitive ops return lazy sequences, and *into* can realize any lazy sequence into a container of any type.
“Well, it would be nice if I didn't have to do both of these [nil and false]. It would be nice if I could do nil and everything else. I would be happy with true and nil. I'm fine with Common Lisp's use of T and nil. I would have been done. I tried to make that work."
“Clojure can have arity-overloaded functions. OK, Clojure doesn't have optional arguments. Instead it has real arity overloading. That means that a single function object can hold inside it multiple function bodies overloaded by arity. That is really fast in Java, and it's quite nice."
“No binding propagation to threads."
“There's only one let. It's let star. It's sequential let."
“it has Common Lisp style defmacro.. you have a lot of hygiene clashes because of the way the reader and packages work in Common Lisp.. So if you separate out Vars from symbols, then symbols can be really simple."