[racket] Quoted expressions in #lang racket

From: John Clements (clements at brinckerhoff.org)
Date: Sun Sep 18 12:25:26 EDT 2011

On Sep 18, 2011, at 9:12 AM, Racket Noob wrote:

> Saying that (quote (1 2 3)) evaluates to (quote (1 2 3)) [instead to (1 2 3)] is the same nonsanse to me like saying that (+ 1 2) evaluates to (+ 1 2) [instead to 3].

Be careful with words like "nonsense" :).

What does 3 evaluate to? 

3

So, numbers evaluate to themselves.  That's because numbers are "values".

In a similar way, #t evaluates to

#t

because it's also a value.

What about (list 1 2 3)? It's *also* a value. That is, (list 1 2 3) evaluates to a list containing three things, the numbers 1, 2, and 3. In Racket, this gets printed as

'(1 2 3)

... so that, like other values, its printed representation is also a legal program piece.

Does this choice make more sense now?

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20110918/8fd0c162/attachment.p7s>

Posted on the users mailing list.