SketchyLISP Reference |
Copyright (C) 2006 Nils M Holm |
<<[memq] | [Index] | [modulo]>> |
Conformance: R5RS
Purpose: Find the minimum of some numbers.
Arguments:
A - number
B... - numbers
Implementation:
(define (min a . b) (letrec ((_min (lambda (a) (cond ((null? (cdr a)) (car a)) ((< (car a) (cadr a)) (_min (cons (car a) (cddr a)))) (#t (_min (cdr a))))))) (cond ((null? b) a) (#t (_min (cons a b))))))
Example:
(min 25 5 -25 0 -5) => -25
<<[memq] | [Index] | [modulo]>> |