Fold applies f recursively to all Docs in d.
(f func(a, b Doc) Doc, d ...Doc)
| 119 | |
| 120 | // Fold applies f recursively to all Docs in d. |
| 121 | func Fold(f func(a, b Doc) Doc, d ...Doc) Doc { |
| 122 | switch len(d) { |
| 123 | case 0: |
| 124 | return Nil |
| 125 | case 1: |
| 126 | return d[0] |
| 127 | default: |
| 128 | return f(d[0], Fold(f, d[1:]...)) |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | // FoldMap applies f recursively to all Docs in d processed through g. |
| 133 | func FoldMap(f func(a, b Doc) Doc, g func(Doc) Doc, d ...Doc) Doc { |
no outgoing calls
no test coverage detected
searching dependent graphs…