i need to create a breadth first search wrapper using zippers. any ideas?
here's one without a zipper (returns first match of pred)
(defn breadth-first [pred coll] (when (seq coll) (or (first (filter pred coll)) (breadth-first pred (apply concat (filter coll? coll))))))
or - I don't know what a "wrapper" is, so maybe that's totally irrellevant
@abhayarawal: did a quick google-ing and didn’t find anything, should be pretty nice exercise writing it :simple_smile:
here’s my actual problem. http://stackoverflow.com/questions/32729795/shortest-path-using-breadth-first-search-in-clojure
@abhayarawal: do you always start searching from the root?
yes
hm, will try to look into it using zippers, just need to bootstrap a simple test file
thanks!
@abhayarawal: got it working here: https://gist.github.com/darwin/6fbc796aa6a8a17e71b3
the iteration needs to carry some state around, see the bfs-visits example it was more difficult than anticipated :simple_smile:
tested under cljs
thanks darwin. i’ll check it out
Any pointers on how our clojurebot /clj is implemented? I want to take it with me to other room :simple_smile:
Ok, I had to google it. It's verma/clj-slackbot in github :simple_smile:
Hi
component library is using a lot of syntax like (map->Something) - I can’t find any macro "map->” and it is not part of clojure core. What this is ? :simple_smile:
And uncle google doesn’t show any sensible results
Is this is just (map -> …)?
@mr-spock: it's a convention
mr-spock: it’s from defrecord
: http://clojure.org/datatypes
Ha - Now I see :simple_smile:
@jcsims: thnx
(find-doc) (doc) did not gave any results