(define (scanl f init ls) (cons init (if (null? ls) '() (scanl f (f init (car ls)) (cdr ls)))))