chickadee » ck-macros » c-dadd1

(c-dadd1 N) → 'N+1 or '#fsyntax

Add 1 to a decimal integer. If 0 <= N <= 15, yields N + 1. Otherwise yields '#f. Added in version 0.3.0.

(ck () (c-dadd1 '0))
;; ==> '1
(ck () (c-dadd1 '15))
;; ==> '16
(ck () (c-dadd1 '16))
;; ==> '#f

The default domain is small because library compilation time increases rapidly the larger the domain is, because it generates a syntax-rules with many branches. You can define an add1 with a larger (or just different) domain using c-make-next and a list of increasing integers:

(ck () `(define-syntax c-my-add1
          ,(c-make-next '(-5 -4 -3 -2 -1 0 1 2 3 4 5))))