I think that is basically what serializable-fn does. Might be worth taking
a look at it:

https://github.com/technomancy/serializable-fn/blob/master/src/serializable/fn.clj

On Tuesday, 26 November 2013, Alex Miller wrote:

> It would help to know what your real goal is, but compiled Clojure does
> not retain the original source form.
>
> One hook you do have though is macros which will be invoked prior to
> compilation. At macro execution time, you have access to the special &form
> var which is the original form (as a Clojure data structure).
>
> Thus you could write a defn-like macro which when called to define a
> function definition would define the function and decorate it with meta
> that included the definition. I am a poor enough macrologist that I will
> not attempt that here but merely suggest it should be feasible. :)
>
> Alex
>
> On Thursday, November 21, 2013 12:14:39 PM UTC-6, henry w wrote:
>>
>> Say you have a function created like this:
>>
>> (fn [x] (+ x y))
>>
>> and then you have a reference to an instance of this function, is there
>> some way to use the function reference to access the list '(fn [x] (+ x y)),
>> including the symbol 'y' (such that you could dereference 'y' and get its
>> value)? The source function is not the right thing and so far googling
>> hasn't got me the answer.
>>
>> Thanks
>>
>  --
> --
> 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<javascript:_e({}, 'cvml', 
> '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 <javascript:_e({}, 'cvml',
> 'clojure%2bunsubscr...@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 <javascript:_e({}, 'cvml',
> 'clojure%2bunsubscr...@googlegroups.com');>.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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/groups/opt_out.

Reply via email to