Last active
October 6, 2015 00:58
-
-
Save kohyama/e98d2c8a7b050765e20b to your computer and use it in GitHub Desktop.
Revisions
-
kohyama revised this gist
Oct 6, 2015 . No changes.There are no files selected for viewing
-
kohyama created this gist
Oct 6, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ (def sss (memoize (fn [s] (let [n (count s)] (cond (zero? n) '(()) (= n 1) `((~s)) :else (mapcat (fn [c] (let [[a b] (split-at c s)] (map #(cons a %) (lazy-seq (sss b))))) (range 1 (inc n))))))))