Subject: Re: I would like for a list to evaluate some terms but not others
From: rpw3@rpw3.org (Rob Warnock)
Date: Mon, 17 Mar 2008 03:56:46 -0500
Newsgroups: comp.lang.scheme
Message-ID: <7Y2dncpgEdvTr0PanZ2dnUVZ_qCunZ2d@speakeasy.net>
Jonathan Mark <jonathansamuel@yahoo.com> wrote:
+---------------
| > What does (cons 1 basepath) produce?
| 
| It produces a flattened list.
...
| But I did not accurately describe in the message above what I wanted
| to do.
| I actually wanted to add a 0 and a 1 to the start of a list.
+---------------

That's what Barry's trying to help you with!

+---------------
| For some reason I wanted to do it in a single command.
+---------------

For *what* reason?!? "Just because" isn't a good way to design programs.

+---------------
| So I wrote:
| (set! basepath (quasiquote (0 . (1 . ,basepath))))
+---------------

I'll bet you that your Scheme implements that something like this
under the hood:

    (set! basepath (cons 0 (cons 1 basepath)))

Why shouldn't you as well?  [Hint: It's even shorter than what you wrote!]


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607