[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Legacy caar to cddddr



On Mon, Oct 24, 2011 at 7:47 AM, Aubrey Jaffer <agj@x> wrote:
>
> LISP is LISt Processing.  CONS, C*R, SET-CAR!, SET-CDR!, MAP, etc are
> a powerful paradigm for list processing, still very much in use.  Lets
> not remove LISP's legacy from Scheme.

This is getting far from the point - no one has suggested
we discourage using lists.

There are two related points under discussion.  One is
where do we draw the line in how many pre-defined c*r
accessors we define?  i.e. up to what N do we provide
c[ad]{1,N}r?  Some historic Lisps had no limit, but this
is not practical in a Scheme standard so RnRS arbitrarily
chose N=4.  I argue that in practice most of these
cases are better suited by other idioms, and we should
set N=2 in (scheme base), possibly with an extension
M=2 or 3 for the c[ad]d{1,M}r case.

The actual examples given in this thread so far only
include up to N=2, M=2, so we can only conclude that
the exception may in fact be necessary.

The other argument is what to name the accessors that
we do provide, i.e. car or first?  I'm not really interested
in pursuing this discussion right now, since we're not
changing it in R7RS.

> How does destructuring work with mutation?  Does assigning to a bound
> variable alter the matched structure?

Wright's syntax does allow for mutation.

> Writing calls to SET-CAR! and SET-CDR! would require binding the pair
> containing the pointer to be changed.  That would destroy the
> obviousness of destructuring, but is easy to deal with using C*R: just
> remove the first character after the "C" (CR is the identity
> function).

I'd be interested to see real-world examples of (set-car! (c[ad]{3,}r x) y).
My guess is these are examples of abusing lists as records.

-- 
Alex

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports