[plt-scheme] Does anyone use `set!' and `get!' patterns?
On Tue, Mar 11, 2008 at 09:59:13AM -0400, Sam TH wrote:
> On Tue, Mar 11, 2008 at 9:36 AM, Eli Barzilay <eli at barzilay.org> wrote:
> > This is probably the original motivation for this feature. For
> > example, with the generic setters in Swindle, you get
> >
> > (inc! (cadddr x))
> >
> > to expand to
> >
> > (set-cadddr! x (+ (cadddr x) 1))
> >
> > and my guess is that with the match setters, it would be like doing
> >
> > (let ([x (cdddr x)]) (set-car! x (+ (car x) 1)))
>
> Right. Something like:
>
> (match x
> [(list-rest c _ _ (set! x!)) (x! (+ c 1))])
That looks useful! If, that is, the objects in question are mutable.
-- hendrik
>
> --
> sam th
> samth at ccs.neu.edu
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme