Nevermind, i was misusing protocols and have clashing interfaces in concrete object.
On Thursday, March 9, 2017 at 11:57:17 PM UTC-3, Paulo César Cuneo wrote: > > Hi When im using [org.clojure/clojure "1.9.0-alpha14"] together with > [org.clojure/tools.analyzer.jvm "0.7.0"] . > It breaks reduce, may be i m misusing protocols, am i ? > > What seems to be happening is imap-cons is receiving seq as o, so it cant > match a proper case. > Guess it happens because java.util.List wins over java.util.Map$Entry in > protocol resolution. > > Odd things is, removing analyzer deps changes behavior. > > (defn- imap-cons > [^IPersistentMap this o] > > #_(defproject cast-exception "0.1.0-SNAPSHOT" > :description "FIXME: write description" > :url "http://example.com/FIXME" > :license {:name "Eclipse Public License" > :url "http://www.eclipse.org/legal/epl-v10.html"} > :dependencies [[org.clojure/clojure "1.9.0-alpha14"] > [org.clojure/tools.analyzer.jvm "0.7.0"] > #_[org.clojure/algo.monads "0.1.6"]] > :main ^:skip-aot cast-exception.core > :target-path "target/%s" > :profiles {:uberjar {:aot :all}}) > > (ns cast-exception.core > (:gen-class)) > > (defrecord Some [a b]) > (defprotocol IMap > (-map [ _ ])) > > (extend-type nil > IMap > (-map [ a ] a)) > > (extend-type Object > IMap > (-map [ a ] a)) > > (extend-type java.util.List > IMap > (-map [ a ] > (map -map a))) > > (extend-type java.util.Map$Entry > IMap > (-map [ a ] > [(-map (first a)) > (-map (second a))])) > > (extend-type java.util.Map > IMap > (-map [ a ] > (if (record? a) > (into a (map #(-map %) (seq a))) > (into (empty a) (map #(-map %) (seq a)))))) > > (let [a (->Some (quote b) 2)] > (-map a)) > > Cheers. > > -- 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.