scanr   xtlang


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

Implementation

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


Back to Index