Re: [Scheme-reports] Legacy caar to cddddr Aubrey Jaffer (23 Oct 2011 22:50 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Alex Shinn (24 Oct 2011 14:09 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Aubrey Jaffer (24 Oct 2011 16:02 UTC)
Re: [Scheme-reports] Legacy caar to cddddr John Cowan (24 Oct 2011 21:17 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Alex Shinn (24 Oct 2011 23:58 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Andre van Tonder (24 Oct 2011 16:04 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Alaric Snell-Pym (24 Oct 2011 16:09 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Alex Shinn (25 Oct 2011 00:07 UTC)
Re: [Scheme-reports] Legacy caar to cddddr John Cowan (24 Oct 2011 17:02 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Ray Dillinger (24 Oct 2011 21:30 UTC)
Re: [Scheme-reports] Legacy caar to cddddr John Cowan (24 Oct 2011 21:51 UTC)

Re: [Scheme-reports] Legacy caar to cddddr Alex Shinn 24 Oct 2011 14:08 UTC

On Mon, Oct 24, 2011 at 7:47 AM, Aubrey Jaffer <agj@alum.mit.edu> 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@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports