Kenny Tilton <ktilton@nyc.rr.com> wrote:
+---------------
| Espen Vestre wrote:
| > A possible problem with tutorials may be that they may fail to stress
| > what QUOTE /really/ does.
|
| Could be. Maybe the way to go is to start with (list 1 2 3) until a
| hairy, nested list is reached. Then introduce '<nested list> with the
| convenience motivation at hand, at the same time emphasizing the gotchas.
+---------------
Another approach that seems to work (the couple of time I've tried it)
is to go ahead and introduce QUOTE, but *not* the <quotation-mark>
reader macro for it [at least not initially]. That way, one can present
QUOTE and LIST as looking more alike, yet focus on QUOTE's "specialness"
in not evaluating, compared to LIST. Only when the person really seems
to grok it do you then say, "Oh, and since it's used a lot there's this
really short abbreviation..."
> (let ((a 42)
(b 53))
(print (quote a))
(print a)
(print (quote 42))
(print 42)
(print (list (quote a)))
(print (list a))
(print (list 42))
(print (list (quote a) (quote b)))
(print (list a b))
(print (list 42 53))
nil) ; just to get the value out of the way
A
42
42
42
(A)
(42)
(42)
(A B)
(42 53)
(42 53)
>
And then maybe they're ready for:
> (let ((a 42)
(b 53))
(print (list a b 42 53))
(print (list (quote a) (quote b) 42 53))
(print (quote (a b 42 53)))
(print '(a b 42 53))
nil)
(42 53 42 53)
(A B 42 53)
(A B 42 53)
(A B 42 53)
>
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607