Hi Stuart, Thanks, that's a nice alternative approach!
Bill On Mon, Oct 27, 2008 at 8:12 AM, Stuart Halloway <[EMAIL PROTECTED]> wrote: > > Hi Bill, > > You could do something like this: > > (defn seq-xor-2-seqs > "Returns the unique values that are in one sequence but not the > other." > [x y] > (let [x (into #{} x) > y (into #{} y)] > (lazy-cat (clojure.set/difference x y) > (clojure.set/difference y x)))) > > Not sure this is more idiomatic, though. And I guess it would perform > worse with huge collections... > > Stuart > >> Hi all, >> >> I've put on my blog (http://bc.tech.coop/blog/081027.html) a post >> about some Clojure language features. In the post, I point out the >> features in a couple of functions that I wrote (which do an "exclusive >> or (XOR)" on sequences). Since I'm new to Clojure and still learning >> how to do things, I would appreciate any comments on whether the code >> could be re-written in a more "idiomatic" manner in Clojure. >> >> Thanks, >> Bill >> > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---