SketchyLISP Reference |
Copyright (C) 2007 Nils M Holm |
<<[odd?] | [Index] | [pair]>> |
Conformance: SketchyLISP Extension
Purpose: Check whether the members of a list are in a given monotonic order.
Arguments:
P - predicate defining order
X - list
Implementation:
(define (ordered? p x) (or (null? x) (null? (cdr x)) (and (p (car x) (cadr x)) (ordered? p (cdr x)))))
Example:
(ordered? > '(9 8 7 6 5)) => #t
See also:
qsort.
<<[odd?] | [Index] | [pair]>> |