[racket] Quoted expressions in #lang racket

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Sun Sep 18 11:15:41 EDT 2011

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:

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


Posted on the users mailing list.