[plt-scheme] Why isn't the car of a list of symbols a symbol?

From: Marco Morazan (morazanm at gmail.com)
Date: Thu Jul 9 19:53:28 EDT 2009

>> ((quote yes) (quote no))
>> is not a value. It is an application expression.
> It most certainly is a value.  It is a list of two elements.

Huh? Really? How do you figure it evaluates to a list with two
elements? Without the quote it IS an application expression!

It is pretty straight forward:

((quote yes) (quote no)) is an application expression

(quote ((quote yes) (quote no))) is a list with two elements

'((quote yes) (quote no)) is a list with two elements

I suggest a little testing:

Welcome to DrScheme, version 4.2 [3m].
Language: Essentials of Programming Languages (3rd ed.); memory limit:
128 megabytes.
> (list? (quote ((quote yes) (quote no)) ))
> (list? '((quote yes) (quote no)) )
> (list ((quote yes) (quote no)))
. . procedure application: expected procedure, given: yes; arguments were: no

That last one means that you are trying to apply 'yes to 'no. Clearly,
it is an application expression.




Posted on the users mailing list.