Re: update-in wildcards?

2009-04-13 Thread Ozzi Lee
> Does clojure have a facility for creating a value that > will never be considered equal to any other value? Duh, brainfart. Gensym will work nicely, of course. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cloju

Re: update-in wildcards?

2009-04-13 Thread Ozzi Lee
Well, I expected someone to tell my that was a horrible idea, not to implement it for me. Thanks! One thing that concerns me is that :* could conceivable be used as a key in a hash-map. Perhaps a separate distinct value should be used as a wildcard? Does clojure have a facility for creating a val

Re: update-in wildcards?

2009-04-12 Thread Mitch
(use '[clojure.contrib.generic.functor :only (fmap)]) (defn update-in-wildcard "Like update-in, but with :* as a wildcard matcher" ([m [k & ks] f & args] (condp = [(= k :*) (boolean ks)] [true true] (fmap #(apply update-in-wildcard % ks f args) m) [true false] (fmap f m) [fa

update-in wildcards?

2009-04-10 Thread Ozzi Lee
I have a structure of nested Maps and Vectors as follows: (def document {:sections [{:items [{:quantity 1} {:quantity 2}]} {:items [{:quantity 3} {:quantity 4}]}]}) The document has a vector of sections (one, in this case), each section has a v