On Jan 15, 2009, at 7:28 AM, HB wrote:
Do *1 *2 *3 ... are saved in a built in sequence that we can inspect its contents?
No, they are separate vars. Here's the code from the core of the read- eval-print loop in clojure/src/clj/clojure/main.clj that shows how they're updated:
(let [input (read)]
(skip-if-eol *in*)
(let [value (eval input)]
(print value)
(set! *3 *2)
(set! *2 *1)
(set! *1 value)))
As a group, *1, *2, and *3 form (effectively) a small queue (not a
stack as someone mentioned previously). If at any point, you want to
see all three together, you can evaluate an expression that puts them
all in a vector:
Clojure
user=> :a
:a
user=> :b
:b
user=> :c
:c
user=> :d
:d
user=> [*1 *2 *3]
[:d :c :b]
Note that evaluating the vector makes that the new "most recent
value": it causes a new "*1" to be pushed into the queue:
user=> [*1 *2 *3]
[[:d :c :b] :d :c]
user=>
--Steve
smime.p7s
Description: S/MIME cryptographic signature
