[racket] Quoted expressions in #lang racket

From: Racket Noob (racketnoob at hotmail.com)
Date: Sun Sep 18 12:12:35 EDT 2011

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].
 > From: sk at cs.brown.edu
> Date: Sun, 18 Sep 2011 11:15:41 -0400
> Subject: Re: [racket] Quoted expressions in #lang racket
> To: racketnoob at hotmail.com
> CC: users at racket-lang.org
> 
> Yep, that's what he's saying.
> 
> I know why you're confused.  Let me see if I can help.
> 
> Here's an input program:
> 
>   '(1 2 3)
> 
> Now be careful to make the following distinction:
> 
> - what it computes
> - what it prints
> 
> What it computes is a list with three values.  There are at least
> three different ways to PRINT this:
> 
> 1.  (1 2 3)
> 2.  #<list>
> 3.  (quote (1 2 3))
> 
> The first has the disadvantage Matthias pointed out: you can't paste
> the value back in in a bigger computation.  The second has the same
> disadvantage.  The third has the advantage you can paste it back in.
> 
> You're probably concerned that pasting it back in "makes a new list".
> Yes, it does.  But if the expression '(1 2 3) were part of some bigger
> computation -- eg,
> 
>   (length '(1 2 3))
> 
> -- then no "new list" would be created.  So it's only if you try
> copying the output of one computation as the input of another that
> there might be new allocation.  But look at the word I just used:
> "copy".
> 
> This isn't the full answer, but I think you need to make sure you've
> got at least these steps under your belt before we go further.  Do ask
> questions.
> 
> Shriram
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110918/b7767d29/attachment.html>

Posted on the users mailing list.