[racket] Confused between strings and symbols

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Sun Oct 27 17:19:53 EDT 2013


The quote form wraps fully-evaluated data, so let's peel away the quote
around the result and see what you have:

(this (is silly))

In quoted data, parentheses mean a list.  So you have a list of two

(is silly)

The first element is a symbol.  The second is a list of two further


Those are also symbols.  If you want to explore this stuff yourself, you
can always use the built-in predicates in Racket:

(define x (list 'this '(is silly)))

(string? x)
(symbol? x)
(list? x)

(define y (first x))
(define z (second x))

(string? y)
(symbol? y)
(list? y)

... and so on.  I don't know if this answers all your questions, but
hopefully being able to explore this stuff yourself will get you a few
steps further.

Carl Eastlund

On Sun, Oct 27, 2013 at 4:23 PM, Bo Gus <forumangus at gmail.com> wrote:

> If I evaluate this:
> (list 'this '(is silly))
> I get this:
> '(this (is silly))
> I just want to check I understand what is happening here.
> list always returns a proper list hence I see no dotted notation here.
> The return value is quoted which means it is a symbol?  But there are
> spaces so can it be a symbol?  And in addition, list returns a proper list
> so it is a list?  A symbolic list?
> Or does the quote in returned just mean it is string data in the list?
> The nested parentheses around is silly is indicating that this is a inner
> list - a list within a list?  What is in the inner list?  Two strings?  One
> string made up of the characters i, s, space, s, i, l, l, y ?
> I suppose the thing that confuses me the most is the idea of a symbol.
>  There are no quotes around the textual information in the returned data so
> do I assume the text is not string data?  If so are they symbols?
> Please help clarify.
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20131027/04f85634/attachment.html>

Posted on the users mailing list.