t3x.org / sketchy / library / pred.html
SketchyLISP
Reference
  Copyright (C) 2006
Nils M Holm

pred

Conformance: SketchyLISP Core

Purpose: Find the predecessor of a decimal digit, where
(pred 0d) => ().

Arguments:
X - digit

Implementation:

(define (pred x)
  (cond ((eq? x 0d) '())
    ((eq? x 1d) 0d)
    ((eq? x 2d) 1d)
    ((eq? x 3d) 2d)
    ((eq? x 4d) 3d)
    ((eq? x 5d) 4d)
    ((eq? x 6d) 5d)
    ((eq? x 7d) 6d)
    ((eq? x 8d) 7d)
    ((eq? x 9d) 8d)
    (#t (bottom 'type-error))))

Example:

(pred 5d) 
=> 4d

See also:
digits, succ.