Fork me on GitHub
#admin-announcements
<
2015-09-23
>
abhayarawal15:09:46

i need to create a breadth first search wrapper using zippers. any ideas?

noisesmith16:09:55

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

noisesmith16:09:12

or - I don't know what a "wrapper" is, so maybe that's totally irrellevant

darwin16:09:22

@abhayarawal: did a quick google-ing and didn’t find anything, should be pretty nice exercise writing it simple_smile

darwin16:09:44

@abhayarawal: do you always start searching from the root?

darwin16:09:09

hm, will try to look into it using zippers, just need to bootstrap a simple test file

darwin17:09:51

the iteration needs to carry some state around, see the bfs-visits example it was more difficult than anticipated simple_smile

darwin17:09:58

tested under cljs

abhayarawal17:09:14

thanks darwin. i’ll check it out

nberger18:09:05

Any pointers on how our clojurebot /clj is implemented? I want to take it with me to other room simple_smile

nberger20:09:12

Ok, I had to google it. It's verma/clj-slackbot in github simple_smile

mr-spock22:09:32

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

mr-spock22:09:09

And uncle google doesn’t show any sensible results

mr-spock22:09:26

Is this is just (map -> …)?

bostonaholic22:09:26

@mr-spock: it's a convention

jcsims22:09:27

mr-spock: it’s from defrecord: http://clojure.org/datatypes

mr-spock22:09:35

Ha - Now I see simple_smile

mr-spock22:09:39

@jcsims: thnx

mr-spock22:09:28

(find-doc) (doc) did not gave any results