scanl   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/adt.xtm

Implementation

(bind-func scanl:[List{!b}*,[!b,!b,!a]*,!b,List{!a}*]*
  (lambda (fn start lst)
    (let ((scan (lambda (l rl)
                  (if (null? l) rl
                      (scan (cdr l)
                            (cons (fn (car rl)
                                      (car l))
                                  rl))))))
      (reverse (scan lst (list start))))))


Back to Index