Re: Don't understand inline vs extend-type implementation of defprotocol across namespaces

2014-08-03 Thread Flea Wong
Thank-you Sean for your answers, I got the example to work and your explanations certainly helped clarify the problem. And it definitely improved my understanding of Clojure. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, se

Re: Don't understand inline vs extend-type implementation of defprotocol across namespaces

2014-08-01 Thread Sean Corfield
On Jul 31, 2014, at 7:19 PM, Flea Wong wrote: > (ns crecords.trec > (:require [crecords.tproc :refer [Fruit]])) You'll need to :refer subtotal here as well: (ns crecords.trec (:require [crecords.tproc :refer [Fruit]])) Then this will work: (defn f1 [] (println "Banana Subtotal:" (subtota

Re: Don't understand inline vs extend-type implementation of defprotocol across namespaces

2014-08-01 Thread Flea Wong
On Friday, August 1, 2014 5:32:15 PM UTC+8, Tassilo Horn wrote: > > Flea Wong > writes: > > Hi! > > I'll take the third question first: > > > 3. Why the different function call "subtotal" (*without* Dot, see > > Apple) vs ".subtotal" (*with* Dot, see Orange) for extend-type vs > > inline im

Re: Don't understand inline vs extend-type implementation of defprotocol across namespaces

2014-08-01 Thread Tassilo Horn
Flea Wong writes: Hi! I'll take the third question first: > 3. Why the different function call "subtotal" (*without* Dot, see > Apple) vs ".subtotal" (*with* Dot, see Orange) for extend-type vs > inline implementation of Fruit? You should always use (subtotal fruit). That with an inline impl

Don't understand inline vs extend-type implementation of defprotocol across namespaces

2014-07-31 Thread Flea Wong
i'm a clojure newbie and am pretty thoroughly confused by defprotocol, inline implementation and extend-type i have the following two small files: crecords.tproc & crecrods.trec listed below: *A) crecords.tproc:* (ns crecords.tproc) (defprotocol Fruit (subtotal [this])) (defrecord Oran