- (defun reduce (func list &optional init) ;; the use of init here is actually a bit broken wrt null
- (let* ((acc))
- (do* ((i (if init -1 0) (1+ i))
- (acc (if init init (elt list 0)) (func acc (elt list i))))
- ((>= i (1- (length list)))))
- acc))
- (defun car (ls)
- (@ ls 0))
- (defun cdr (ls)
- (chain ls (slice 1)))
- (defun reverse (ls)
- (chain ls (reverse)))
|