chickadee » ck-macros » c-dsub1

(c-dsub1 N) → 'N-1 or '#fsyntax

Subtract 1 from a decimal integer. If 1 <= N <= 16, yields N - 1. Otherwise yields '#f. See the notes for c-dadd1.

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

As with c-dadd1, you can define a sub1 with a larger (or just different) domain using c-make-next and a list of decreasing integers:

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