[plt-scheme] Does anyone use `set!' and `get!' patterns?

From: Sam TH (samth at ccs.neu.edu)
Date: Tue Mar 11 09:59:13 EDT 2008

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

-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.