RosettaCodeData/Task/Pointers-and-references/Racket/pointers-and-references.rkt

10 lines
126 B
Racket
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
#lang racket
(define (inc! b) (set-box! b (add1 (unbox b))))
(define b (box 0))
(inc! b)
(inc! b)
(inc! b)
(unbox b) ; => 3