(defn compute3 {:test (fn [] (is= (compute3 (create-state "F4 . . . . . " "F3 . . . LG . " "F2 . HG . . . " "F1 E . HM . LM ")) 11))} [state] (let [done-simple-state (state->simple-state (construct-finished-state state)) inner-fn (fn [states steps java-memory-map] (println "On step" steps) (println "Number of states" (count states)) (let [next-states (->> states (map (fn [state] (->> (get-next-states state) (filter (fn [s] (nil? (.get java-memory-map (state->simple-state s)))))))) (flatten))] ;; (println (count next-states)) <- Uncomment this line to change the behavior (if (.get java-memory-map done-simple-state) steps (do (doseq [next-state next-states] (.put java-memory-map (state->simple-state next-state) steps)) (recur next-states (inc steps) java-memory-map)))))] (inner-fn [state] 0 (java.util.HashMap.))))
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.