ldnclj

Find us on #clojure-uk
agile_geek 2016-01-11T08:12:18.000976Z

Morning from train in Yorkshire. Sad news about David Bowie this morning 😢

thomas 2016-01-11T09:22:14.000977Z

Morning

thomas 2016-01-11T09:22:29.000978Z

yes.... another one bites the dust...

thomas 2016-01-11T09:22:36.000979Z

oops.. wrong band

😆 1
jamiei 2016-01-11T10:10:48.000980Z

Morning all

mccraigmccraig 2016-01-11T10:59:35.000981Z

måning yål

practicalli-john 2016-01-11T11:09:50.000982Z

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...

practicalli-john 2016-01-11T16:23:05.000985Z

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.

2016-01-11T23:36:42.000986Z

@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)))

2016-01-11T23:38:10.000987Z

actually make the j (inc (count s)). i was off by one