If you are just printing it to the screen, print or println will do
what you want.  There shouldn't be a need for a pretty printer, the
source is already formatted exactly as it was written.


On Tue, Mar 6, 2012 at 1:02 AM, Nikem <gni...@gmail.com> wrote:
> Thank you for your help! :)
>
> I managed to get repl/source-fn to read source from external namespace. But
> print gives me
> "(defn buy? [today]\n  (and\n    (not (nil? today))\n    "
>
> Everything on one line with "\n" instead of new lines. Shouldn't pretty
> print handle this?
>
> Best wishes
> Nikem
>
>
> On Tuesday, March 6, 2012 12:32:28 AM UTC+2, Phil Hagelberg wrote:
>>
>> Nikem <gni...@gmail.com> writes:
>>
>> >  java -jar lib/clojure-1.3.0.jar
>> > user=> (defn qw []
>> >   (inc 2))
>> > #'user/qw
>> > user=> (use 'clojure.repl)
>> > nil
>> > user=> (clojure.repl/source-fn qw)
>> > ClassCastException user$qw cannot be cast to clojure.lang.Symbol
>> >  clojure.core/ns-resolve (core.clj:3879)
>> > user=> (clojure.repl/source-fn 'qw)
>> > nil
>> > user=> (println (clojure.repl/source-fn 'qw))
>> > nil
>> > nil
>> > user=>
>> >
>> > What am I doing wrong?
>>
>> source will only check for definitions on disk; you need serializable-fn
>> for something like this to work.
>>
>> -Phil
>
> --
> 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 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

Reply via email to