Re: Writing code to get the source of a function

2012-08-08 Thread Samuel Lê
Using serializable works fine for me. I find its code very instructive as well. Thanks! On Wed, Aug 8, 2012 at 7:18 PM, Alan Malloy wrote: > (println (with-out-str (foo))) is silly - it's the same as (do (foo) nil), > which in many cases (eg, in this one) is the same as just (foo). > > > On Wedn

Re: Writing code to get the source of a function

2012-08-08 Thread Alan Malloy
(println (with-out-str (foo))) is silly - it's the same as (do (foo) nil), which in many cases (eg, in this one) is the same as just (foo). On Wednesday, August 8, 2012 6:25:35 AM UTC-7, Joshua Ballanco wrote: > > On Wed, Aug 08, 2012 at 09:19:15AM +, Samuel Lê wrote: > > Dear all, > > > >

Re: Writing code to get the source of a function

2012-08-08 Thread Joshua Ballanco
On Wed, Aug 08, 2012 at 09:19:15AM +, Samuel Lê wrote: > Dear all, > > I am trying to write some code that would take a function name, get its > source code, and create a new function based on the source code. > Unfortunately, the function 'source' from clojure.repl doesn't seem to be > workin

Re: Writing code to get the source of a function

2012-08-08 Thread Moritz Ulrich
The source function only works for function where the .clj where the function is defined is in the classpath. If you have control over all functions, I'd suggest using https://github.com/technomancy/serializable-fn when defining them. On Wed, Aug 8, 2012 at 11:19 AM, Samuel Lê wrote: > Dear all,

Writing code to get the source of a function

2012-08-08 Thread Samuel Lê
Dear all, I am trying to write some code that would take a function name, get its source code, and create a new function based on the source code. Unfortunately, the function 'source' from clojure.repl doesn't seem to be working for the functions I define. Here is my code: (ns test-src.core (:r