aboutsummaryrefslogtreecommitdiff
path: root/algebraic-structures.monoid.fold.scm
blob: 5e176f22107ac558ad9aa8e86e2bea102b1ac351 (about) (plain)
1
2
3
4
5
6
7
8
9
10
(functor ((algebraic-structures monoid fold) (M (<> unit)) (F (fold))) (fold)
  (import scheme M (rename F (fold foldable:fold)))

  (define (fold x) (foldable:fold <> unit x))

  (define (fold-map f x)
    (foldable:fold (lambda (x acc)
                     (<> (f x) acc))
                   unit
                   x)))