On Oct 26, 2011, at 7:08 PM, e wrote:

> [1 2 3] is a vector that is not evaluated.  Since there is no overload with 
> things that are, there's no need for a special mark.

If you type [1 2 3] into the REPL it is evaluated. The E part of the REPL 
always runs. Some expressions evaluate to themselves. In this case each number 
evaluates to itself and the vector evaluates to itself:

  user> [1 2 3]
  [1 2 3]

If you have an expression as one of the items in the vector, it will be 
evaluated:

  user> [1 (+ 1 1) 3]
  [1 2 3]

Putting a quote out front suppresses all evaluation:

  user> '[1 (+ 1 1) 3]
  [1 (+ 1 1) 3]

> '(1 2 3) is currently a way of say, "don't evaluate this list",

More completely it says, "don't evaluate the entire expression that follows 
including any and all sub-expressions"

> but it could have been:
> 
> '(1 2 3) is a list that is not evaluated.  No loss of generality.  it's a 
> special type of list.  One that's not evaluated.  as opposed to a special 
> indicator to the repl.

Current behavior:

  user> '(1 (+ 1 1) 3)
  (1 (+ 1 1) 3)

The behavior you propose:

  user> '(1 (+ 1 1) 3)
  (1 2 3)

Currently 'x is equivalent to (quote x) for all values of x. With the syntax 
you propose that's no longer true.

clojure.main/repl allows you to replace the evaluator with any function of one 
argument. If you bring up a repl with, say, lein repl, you can start a nested 
repl with identity as the evaluator and see how things are read (which can be 
interesting):

  % lein repl
  REPL started; server listening on localhost port 46512
  user=> (clojure.main/repl :eval identity)
  user=> (+ 1 2)
  (+ 1 2)
  user=> '(+ 1 2)
  (quote (+ 1 2))
  user=> [1 2 3]
  [1 2 3]
  user=> [1 (+ 1 1) 3]
  [1 (+ 1 1) 3]
  user=> 'x
  (quote x)
  user=> x
  x
  user=> '[1 (+ 1 1) 3]
  (quote [1 (+ 1 1) 3])
  user=> #(+ 3 %)                                                               
                                                                                
                                              
  (fn* [p1__161#] (+ 3 p1__161#))

--Steve

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to