Home > Archive > Scheme > September 2006 > rest arguments (was Re: Why cons *pairs*?)
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
rest arguments (was Re: Why cons *pairs*?)
|
|
| Tom Lord 2006-09-13, 7:04 pm |
| There is still, arguably, a flaw in Scheme that, truly,
makes cons pairs too much of a "foundation": rest
arguments. If it were not for rest arguments,
cons pairs could be made an optional feature. RnRS
would specify how cons pairs must work if they are
present and presented using reserved identifiers
like 'cons' and 'cdr' but one could have an
implementation without them and still write lots of
useful code.
At the risk of some bloat, but at the gain of more
options for implementations, RnRS might be improved
by:
1) adding a minimal set of sequence operators
2) specifying that rest arguments are a sequence
but leaving it unspecified how that sequence is
represented.
-t
| |
| Ron Garret 2006-09-13, 7:04 pm |
| In article <1158162053.966120.289820@i42g2000cwa.googlegroups.com>,
"Tom Lord" <lord@emf.net> wrote:
> There is still, arguably, a flaw in Scheme that, truly,
> makes cons pairs too much of a "foundation": rest
> arguments.
It's not so much rest argument per se, but rather using dot notation to
indicate rest arguments. CL's syntax for rest arguments does not depend
on underlying cons cells for its rationalization.
Another avenue to explore: with only a single generic cons cell type,
the predicate proper-list? is necessarily O(n), and forgetting to check
for a non-nil terminal CDR is a perennial source of bugs even in
experienced programmers' code. But this is easily remedied by
introducing a second kind of cons cell, the proper-cons, which is just
like a regular cons cell except that its CDR can only contain NIL or
another proper-cons. Basing a Lisp-like language on proper-cons cells
instead of cons cells (which is not to say that cons cells ought to be
eliminated, only that CODE should be represented with proper-cons cells)
would be a very small incremental step away from regular Lisp, one which
may have beneficial effects (like eliminating certain classes of bugs)
and which, to my knowledge, has not been explored at all.
rg
|
|
|
|
|