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 Aubrey Jaffer 24 Oct 2011 15:59 UTC

 | Date: Mon, 24 Oct 2011 23:08:22 +0900
 | From: Alex Shinn <alexshinn@gmail.com>
 |
 | On Mon, Oct 24, 2011 at 7:47 AM, Aubrey Jaffer <agj@alum.mit.edu> wrote:
 |
 | ...
 | 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.
 |
 | > How does destructuring work with mutation?  Does assigning to a
 | > bound variable alter the matched structure?
 |
 | Wright's syntax does allow for mutation.

Cool!  URL for Wright's syntax?

Does it have a way to match without binding; or does one need to match
the whole structure even when interested in only one slot?

 | > 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).

Here are uses matching "set-c[ad]r! (c[ad][ad][ad]"

scm/hobbit.scm:5722:
	(if (and (pair? (cadar part))
		 (eq? 'lambda (caadar part))
		 (all-liftable? (cddr (cadar part)))
		 (liftable-nameocc? name (cddr (cadar part)))
		 (liftable-nameocc? name (cons 'begin passed))
		 (liftable-nameocc? name (cons 'begin (cddr term))))
	    (begin
	      (set! *local-liftnames*
		    (cons name *local-liftnames*))
	      (set-car! (cadar part) *liftable-lambda*)))

slib/prec.scm:60:
(define (tok:read-char dyn)
  (let ((c (read-char (cadr dyn))))
    (set-car! (cddddr dyn)
	      (if (or (eqv? c #\newline) (eof-object? c))
		  0
		  (+ 1 (car (cddddr dyn)))))
    c))

slib/dbutil.scm:291:
   (if (file-unlock! filename certificate)
       (set-car! (cdddr entry) #f)
       (slib:warn 'file-unlock! filename certificate 'failed))

 | My guess is these are examples of abusing lists as records.

When using association-lists it is natural to use a list for other
fields.  I don't consider that abuse.

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