min-max   scheme


Defined in:  https://github.com/lambdamusic/extempore-extensions/blob/main/init/init_lisp.xtm

Implementation

(define (min-max lst)
  (let helper ((lst (cdr lst)) (cur-min (car lst)) (cur-max (car lst)))
    (if (null? lst)
        (list cur-min  cur-max)
        (helper (cdr lst)
                (helper:min cur-min (car lst))
                (helper:max cur-max (car lst))))))


Back to Index