Knuth's algorithm S: Difference between revisions

m
(added Clojure version)
Line 404:
If we really need a stateful (thread safe!) function for some reason, we can get it like this:
<lang clojure>(defn s-of-n-creator [n]
(let [state (atom ([[] 0)])
s-of-n-fn (s-of-n-fn-creator n)]
(fn [item]
Anonymous user