Thanks so much Ambrose! I know that function is simple, but I don't understand how it provides the functionality I'm after. Do you mind explaining what's going on? I'm playing with it now in my repl.
Thanks!! On Friday, July 25, 2014 6:48:06 PM UTC-4, Ambrose Bonnaire-Sergeant wrote: > > Hi Geoff, > > You probably want a sorted-map-by: > > user=> (sorted-map-by (fn [a b] (or (when (every? coll? [a b]) (when (= a > (reverse b)) 0)) -1)) [1 2] 42 [2 1] 42) > {[1 2] 42} > > Thanks, > Ambrose > > > On Fri, Jul 25, 2014 at 9:52 AM, Geoff Little <fifo...@gmail.com > <javascript:>> wrote: > >> I'm attempting to proxy PersistentHashmap so that "get"ting an existing >> key or its reverse returns the same value. >> >> Here's the code that I have >> >> (defn sym-key-hash-map [] >> (proxy [clojure.lang.PersistentHashMap] [nil 0 nil false nil] >> (valAt [key] >> (or (proxy-super valAt key) >> (proxy-super valAt (reverse key)))))) >> >> (let [key (list 1 2)] >> (get (assoc (sym-key-hash-map) key "sweet") >> (reverse key))) >> >> But unfortunately, the test code returns nil instead of "sweet". >> >> Does anyone with knowledge of proxy and PersistentHashmap know how to >> solve this? >> >> Thanks. >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com >> <javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+u...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.