17 lines
292 B
Scheme
17 lines
292 B
Scheme
|
(library
|
||
|
(utils)
|
||
|
(export inc!
|
||
|
dec!)
|
||
|
(import (rnrs))
|
||
|
|
||
|
(define-syntax inc!
|
||
|
(syntax-rules ()
|
||
|
((_ v) (set! v (+ 1 v)))
|
||
|
((_ v n) (set! v (+ n v)))))
|
||
|
|
||
|
(define-syntax dec!
|
||
|
(syntax-rules ()
|
||
|
((_ v) (set! v (- v 1)))
|
||
|
((_ v n) (set! v (- v n)))))
|
||
|
)
|