News for hackers. Stuff that matters.
Re:Steve Yegge's foreword to Joy of Clojure by herdrick on Sunday March 20, 2011 @08:12PM (#2347842)
Thanks for this. I didn't know about update-in. Are there other 'update' functions?

However, it's a good thing you want a DAG, because with immutable data structures you're hosed if you want a cyclic graph. Or at least you won't be building them out of such structures, which means you aren't getting to use Clojure's functions for sequences, collections and maps. Thus Clojure does not seem to be a good tool for graphs.

Re:Steve Yegge's foreword to Joy of Clojure by arohner on Monday March 21, 2011 @12:44AM (#2348511)
Actually, when I said 'update', I meant the functions that in standard languages that would modify the existing structure return a new one, but it's great you found update-in. That's a beautiful function. There's also assoc-in, which is basically just a more specialized assoc-in.

I've built cyclical graphs in Clojure. The simplest form looks like

   {:nodes #{:a :b :c}
    :edges {:a #{:b}
            :b #{:c}
            :c #{:a}}}
(for non-clojurians, {} is a map, and #{} is a set)