Re: extend-type and extend-protocol: different syntax for multi-arity methods

2015-05-14 Thread Alexey Cherkaev
:46, Tassilo Horn wrote: > Alexey Cherkaev writes: > > Hi Alexey, > > > If you have a protocol > > > > (defprotocol Foo (foo [x] [x y])) > > > > and implement it for the record > > > > (defrecord Bar [p q r] > > Foo > >

extend-type and extend-protocol: different syntax for multi-arity methods

2015-05-13 Thread Alexey Cherkaev
Hi all, If you have a protocol (defprotocol Foo (foo [x] [x y])) and implement it for the record (defrecord Bar [p q r] Foo (foo [x] x) (foo [x y] [x y])) you write each method separately. The same is true for extend-type. Yet, if you use extend-protocol syntax is more like usual Clojure

Re: Strange behaviour of a callable record

2015-04-24 Thread Alexey Cherkaev
the second example while invoke is used in the > other cases has to do with implementation details of how def expressions > are compiled/evaluated. > > Alexey Cherkaev writes: > > > Hi, > > > > I have encountered the problem with Clojure 1.6.0, when I create the

Strange behaviour of a callable record

2015-04-23 Thread Alexey Cherkaev
Hi, I have encountered the problem with Clojure 1.6.0, when I create the record that implements IFn. For example, (defrecord Foo [x] clojure.lang.IFn (invoke [_ f] (f x))) Than create an instance of this record: (def f (->Foo 10)) And we can call it without a problem: user=> (f inc)