]> git.rkrishnan.org Git - sicp.git/blob - src/sicp/ex2_38.rkt
Solution to 4.44. A bit too verbose. Can be improved by better
[sicp.git] / src / sicp / ex2_38.rkt
1 #lang racket
2
3 (define (fold-left op initial coll)
4   (define (iter result rest)
5     (if (null? rest)
6         result
7         (iter (op result (car rest))
8               (cdr rest))))
9   (iter initial coll))
10
11 (provide fold-left)