Morning from train in Yorkshire. Sad news about David Bowie this morning 😢
Morning
yes.... another one bites the dust...
oops.. wrong band
Morning all
måning yål
Hello, any suggestions on how to generate all the permutations of a given string. Eg. given "abcdedcba" I would like to return ["a" "ab" "abc" "abcde" "abcded" "abcdedc" "abcdedcba" "b" "bc" "bcd".... etc etc...
jr0cket: canned solution - https://github.com/clojure/math.combinatorics/blob/master/src/main/clojure/clojure/math/combinatorics.clj#L290
Thanks @mccraigmccraig the combinatorics does what its supposed to do, however I now have too many cobinations. I only want combos that exist within the original string. So i guess I can filter the output and drop any combos that are not sub strings of the original string.
@jr0cket if you just want all substrings then (let [s "abcdedcba"] (for [i (range (count s)) j (range (count s)) :when (< i j)] (subs s i j)))
actually make the j (inc (count s)). i was off by one