(define (scanl f init ls) (if (equal? ls '()) (list init) (let ((next (scanl f (f init (first ls)) (rest ls)) )) (cons init next) )))