> What about box-cas! ? You might find it handy to use box-cas! via a "swap" style wrapper, such as box-swap! from rackjure/utils:
(define (box-swap! box f . args) (let loop () (let* ([old (unbox box)] [new (apply f old args)]) (if (box-cas! box old new) new (loop))))) https://github.com/greghendershott/rackjure/blob/master/rackjure/utils.rkt#L21-L27 Then you can express it as: (define counter (box 0)) (box-swap! counter add1) -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.