On Sun, May 17, 2009 at 1:40 PM, philip.hazel...@gmail.com <
philip.hazel...@gmail.com> wrote:
>
> On May 17, 1:14 am, "Michel S." wrote:
> > In Clojure, it is possible to do the former -- (def orig+ +) -- but it
> > appears that overriding a clojure.core definition is not possible. I'd
> > love
On May 17, 1:14 am, "Michel S." wrote:
> In Clojure, it is possible to do the former -- (def orig+ +) -- but it
> appears that overriding a clojure.core definition is not possible. I'd
> love to be wrong on this, though.
>
> user=> (def + -)
> java.lang.Exception: Name conflict, can't def + becau
On 17.05.2009, at 03:43, bradford cross wrote:
> First item of business - there are no operators, operators are
> functions.
>
> I think the Clojure way to do this is via multimethods: http://
> clojure.org/multimethods
>
> I might just be naive, but it seems like more of core would need to
Hi,
Am 17.05.2009 um 03:43 schrieb bradford cross:
First item of business - there are no operators, operators are
functions.
I think the Clojure way to do this is via multimethods:
http://clojure.org/multimethods
I might just be naive, but it seems like more of core would need to
be impl
>Yes, the general consensus is that basic math needs to be as fast as
>possible, even at the expense of some flexibility.
It's worth noting here that one can also use binding to override other
than arithmetic core functions;
(defn ustr [s] (binding [clojure.core/str
(fn [x] (.toUpperCase x))]
bradford cross writes:
> First item of business - there are no operators, operators are functions.
>
> I think the Clojure way to do this is via multimethods:
> http://clojure.org/multimethods
>
> I might just be naive, but it seems like more of core would need to be
> implemented as multimeth
One way to accomplish this is via :refer-clojure in ns.
Usage is like:
(ns test
(:refer-clojure :exclude [+]))
This would allow you to, for example, dispatch the implementation
based on the type of the first argument via multimethods (as Michel S.
noted, at a performance penalty). The origina
First item of business - there are no operators, operators are functions.
I think the Clojure way to do this is via multimethods:
http://clojure.org/multimethods
I might just be naive, but it seems like more of core would need to be
implemented as multimethods in order to do this.
Has this come
On May 16, 4:32 pm, Saptarshi wrote:
> Hello,
> I am totally new to Clojure and have dabbled in Scala. In Scala, it is
> possible to override the + operator ,e.g a class A can overide +.
> In Clojure, I would have a struct and not a class. Can I still
> override the + operator in Clojure?
>
In
Hello,
I am totally new to Clojure and have dabbled in Scala. In Scala, it is
possible to override the + operator ,e.g a class A can overide +.
In Clojure, I would have a struct and not a class. Can I still
override the + operator in Clojure?
Regards
Saptarshi
--~--~-~--~~---
10 matches
Mail list logo