g.StackWalker*/getInstance *java.lang.StackWalker$Option*
>>>> /RETAIN_CLASS_REFERENCE)
>>>>
>>>> #_=> (*+* a b))
>>>>
>>>> #'dev/add
>>>>
>>>> dev=> (add 1 2)
>>>>
>>>> dev/add
&
t;> /RETAIN_CLASS_REFERENCE)
>>>
>>> #_=> (*+* a b))
>>>
>>> #'dev/add
>>>
>>> dev=> (add 1 2)
>>>
>>> dev/add
>>>
>>> 3
>>>
>>> dev=>
>>>
>>>
mi!
>>
>> On Thu, Apr 29, 2021 at 12:08 PM Remi Forax wrote:
>>
>>>
>>>
>>> --
>>>
>>> *De: *"Sean Corfield"
>>> *À: *"clojure"
>>> *Envoyé: *Jeudi 29 Avril 2021 01:26
b))
>
> #'dev/add
>
> dev=> (add 1 2)
>
> dev/add
>
> 3
>
> dev=>
>
> Thanks, Rémi!
>
> On Thu, Apr 29, 2021 at 12:08 PM Remi Forax wrote:
>
>>
>>
>> --
>>
>> *De: *"Sean Corfield&qu
;
Thanks, Rémi!
On Thu, Apr 29, 2021 at 12:08 PM Remi Forax wrote:
>
>
> --
>
> *De: *"Sean Corfield"
> *À: *"clojure"
> *Envoyé: *Jeudi 29 Avril 2021 01:26:34
> *Objet: *Re: How get function name in body?
>
> Consider that
> De: "Sean Corfield"
> À: "clojure"
> Envoyé: Jeudi 29 Avril 2021 01:26:34
> Objet: Re: How get function name in body?
> Consider that:
> (defn add [a b] (+ a b))
> is expanded to (something like):
> (def add (fn [a b] (+ a b)))
> So the
orks.com/
"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)
On Wed, Apr 28, 2021 at 6:35 AM damon kwok wrote:
>
> How get function name in body?
>
> (defn add [a b]
> ;; how get "add" here?
> (+ a b))
&g
Well, it seems like it should be possible. At the end of the defn macro,
metadata is attached to a function, so you can see the name with:
```
(meta #'my.ns/add)
```
And you could do this inside the function:
```
(defn add [a b]
(let [name (:name (meta #'add))]
(str a b name)))
```
But
How get function name in body?
(defn add [a b]
;; how get "add" here?
(+ a b))
--
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 ar