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

From: Marco Morazan (morazanm at gmail.com)
Date: Fri Jul 10 16:08:46 EDT 2009

>
> Or are you instead treating '(a b c) as a literal of type "list", and (quote
> (a b c)) as an application expression that evaluates to it?  I guess
> somebody could implement a Scheme that way; I don't know whether DrScheme is
> in fact implemented that way.  It strikes me as an unnecessary complication.

I see where the confusion is now. (quote (a b c)) is not an
application expression just like (cond ((zero? x) 5) (else 2))) is
also not an application expression. Neither quote nor cond (nor
check-expect for that matter) are functions. They are used to signal
syntactic forms. We do not say that we apply quote to (a b c) just
like we don't say that we apply cond to ((zero? x) 5) (else 2)). We
also do not apply ' to (a b c). (a b c) represents: a applied to b and
c (notice no quotes on a, b, and c). '(a b c) and (quote (a b c)) are
equivalent to (list 'a 'b 'c) (notice the quotes on a, b, and c). If
you tell your students that (a b c) is a list, then how can they tell
that list apart from the expression that applies a to b and c? I do
not enjoy being obscure, but what would you tell students about a line
of code like this: ((a b c) '(a b c)) ?

In any case, we have discussed this way too much. I am not going to
convince you that ((quote yes) (quote no)) is an application
expression (which when evaluated, of course, will give you the error
that 'yes is not a function). FWIW, a lightbulb goes off in my
student's head when it finally clicks that expressions like ((quote
yes) (quote no)) are applications and not lists. It takes time for
them to digest the difference between ((quote yes) (quote no)) and
'((quote yes) (quote no)) in their programs. That, however, is just my
experience.


-- 

Cheers,

Marco


Posted on the users mailing list.