On May 17, 1:14 am, "Michel S." <michel.syl...@gmail.com> 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 + because namespace:
> user refers to:#'clojure.core/+ (NO_SOURCE_FILE:5)

This just means you can't create user/+. What you can do is redefine
clojure.core/+.

user=> (def clojure.core/+ -)
java.lang.Exception: Can't create defs outside of current ns
(NO_SOURCE_FILE:1)
user=> (in-ns 'clojure.core)
#<Namespace clojure.core>
clojure.core=> (def + -)
#'clojure.core/+
clojure.core=> (in-ns 'user)
#<Namespace user>
user=> (+ 3 1)
2

I'm sure this is something you should avoid, especially given the
other solutions. But the option is there.
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to