[plt-scheme] Does anyone use `set!' and `get!' patterns?
On Wed, Mar 12, 2008 at 4:21 PM, <hendrik at topoi.pooq.com> wrote:
>
> 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.
You might think so. But after at least 5 years, it seems to have
gotten no use at all. Do you have any particular uses in mind?
Thanks,
--
sam th
samth at ccs.neu.edu