It sounds like you're looking for refer-clojure:
https://clojuredocs.org/clojure.core/refer-clojure

E.g., for your project:

(ns mw.mwm
  (:require
   [clojure.pprint :as pp]
   [clojure.walk :as walk])
  (:refer-clojure :exclude [defn])
  (:gen-class))

Tested in a fork:
https://github.com/mattiasw2/cdn77-purge/compare/renamed_to_defn...benizi:fix-defn-issue

Defining your own `defn` is a fairly unorthodox thing to do.  (Usually it's
less Clojure-centric names that cause problems, like `time` from the
example, or `filter`, `min`, or `max`.)  Based on your comment
<https://github.com/mattiasw2/cdn77-purge/blob/ee259d6dee23c732067b80df57a4f5f064eacd0b/src/mw/mwm.clj#L44-L46>,
it seems easier to just write a different version of `get` that handles
nils the way you want, instead of complicated macro behavior.  E.g.:

(defn get!   ;; "!" seems better than "?" to indicate the "dangerous" assert
  "Get a value out of a map, asserting it is non-nil"
  [from key]
  (let [val (get from key)]
    (assert (some? val) (str key " is nil"))
    val))

Seems much more straightforward than a macro that translates (:key? map) to
something roughly equivalent to (get! map :key).

Best,
Ben

On Wed, Nov 25, 2015 at 3:29 AM, mattias w <matti...@gmail.com> wrote:

> I moved my own definition of defn to a separate project, and then it
> works. It seems you cannot redefine defn within the same project it is used.
>
>
> Den fredag 13 november 2015 kl. 13:46:56 UTC+1 skrev mattias w:
>>
>> I defined my own defn in the namespace mwm.
>>
>>
>> My new code looks like this
>>
>>
>> (mwm/defn foo [x] ...)
>>
>>
>> Everything was fine as long as it was called defn2, but after renaming it
>> to defn and refering to the original defn using clojure.core/defn, only
>> "lein uberjar" works.
>>
>> When I run "lein run", the compilation fails as
>>
>>
>> c:\data3\clojure\cdn77-purge>lein run
>> WARNING: defn already refers to: #'clojure.core/defn in namespace: mw.mwm, 
>> being
>>  replaced by: #'mw.mwm/defn
>> Exception in thread "main" java.lang.ClassNotFoundException: mw.mw1, 
>> compiling:(
>> mw/mw1.clj:40:1)
>>         at clojure.lang.Compiler.analyze(Compiler.java:6543)
>>         at clojure.lang.Compiler.analyze(Compiler.java:6485)
>>         at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791)
>>         at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725)
>>
>>
>> The code can be found at
>> https://github.com/mattiasw2/cdn77-purge/tree/renamed_to_defn
>>
>>
>>
>> --
> 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.
>

-- 
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.

Reply via email to