1Yti8jqQuUpdY8t8mKOg9 changeset
| Changeset | 343130363934 (b) |
|---|---|
| Parent | None (a) |
| a | b | ||
|---|---|---|---|
| 0 | + | (fn combine [c w] ; combine a word with a collection in every possible way | |
| 0 | + | (for [x (range (inc (count c)))] | |
| 0 | + | (let [[c1 c2] (split-at x c)] | |
| 0 | + | (concat c1 [w] c2)))) | |
| 0 | + | ||
| 0 | + | ; usage | |
| 0 | + | (reduce #(mapcat (fn [c] (combine c %2)) %) [[]] s) | |
| ... | |||
|
|