Of course Clojure sequences are lazy.
(defn map
([f coll]
(lazy-seq
(when-let [s (seq coll)]
(cons (f (first s)) (map f (rest s))))))
Inside a LAZY-SEQ the operations are just that.They are also not acting like cons cells:
user=> (cons 1 2)
IllegalArgumentException Don't know how to create ISeq from: java.lang.Long clojure.lang.RT.seqFrom (RT.java:496)
> As far as I know, there hasn't ever been a Lisp system that could parse and run thatWhat you saw in the file was the source code used by the first Lisp implementation.
> an interpreter
That was no 'interpreter'. Mostly a different reader.
> what you'd write in any modern Lisp looks a lot more like the Clojure version than the LISP 1.5 version.
Not necessarily. See the Lisp source for http://www.shenlanguage.org/Download/download.html
Plain old-style Lisp code.
There are not many modern Lisp books. If you look at PAIP, that is old-style. PCL is more modern. But neither has the look or feel of Clojure.
But I'm not saying that Lisp's don't contain new stuff. I'm saying that they contain the old stuff + new stuff.
Clojure gets rid of core old stuff:
* names are different
* concepts are removed (mutable cons cells, ...)
* syntax is different from every other Lisp
* semantics is different (persistent data structures, ...)
> By "persistent" Clojure means "immutable"
immutable and persistent are different, but related concepts. A data structure can be immutable, but it does not need to be persistent. 'Persistent' means that an immutable data structure can be updated, keeps all its versions and provides certain performance/space characteristics (one does not do full copies for example).
Imagine a list (f o o b a r). Now I want to insert 1 between f o o and b a r.
Immutable: I need to make a new list with elements from the old list copied.
Immutable and Persistent: I make a new list, but I possibly reference parts of the old data structure. Thus I don't need to make a full copy.
Lisp's lists/vectors/... are not immutable and also not persistent.
Clojure replaces that. Just read http://clojure.org/sequences