Fold applies f recursively to all Docs in d.
(f func(a, b Doc) Doc, d ...Doc)
| 137 | |
| 138 | // Fold applies f recursively to all Docs in d. |
| 139 | func Fold(f func(a, b Doc) Doc, d ...Doc) Doc { |
| 140 | switch len(d) { |
| 141 | case 0: |
| 142 | return Nil |
| 143 | case 1: |
| 144 | return d[0] |
| 145 | default: |
| 146 | return f(d[0], Fold(f, d[1:]...)) |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | // FoldMap applies f recursively to all Docs in d processed through g. |
| 151 | func FoldMap(f func(a, b Doc) Doc, g func(Doc) Doc, d ...Doc) Doc { |
no outgoing calls
no test coverage detected