Re: attaching doc-string from macro is driving me insane!

2013-02-24 Thread Jim - FooBar();
On 24/02/13 19:44, AtKaaZ wrote: The problem is that you cannot catch that assert if it throws, ie. inside a deftest - just because it happens at compile time... a deftest will have its own top-level assertion...this is for client usage -- -- You received this message because you are subscr

Re: attaching doc-string from macro is driving me insane!

2013-02-24 Thread Jim - FooBar();
On 24/02/13 19:44, AtKaaZ wrote: you can maybe do with just (vec components) instead of (vector ~@components) nice one! it works :) Jim -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.co

Re: attaching doc-string from macro is driving me insane!

2013-02-24 Thread AtKaaZ
you can maybe do with just (vec components) instead of (vector ~@components) => (defmacro x [& lst] (let [a (eval (vec lst))] `~a ) ) #'util.funxions/x => (x 1 2 3) [1 2 3] I think eval is okay there, because it should only happen at compile time (or I'm missing something).

Re: attaching doc-string from macro is driving me insane!

2013-02-24 Thread Jim - FooBar();
~PHEW, @~ I cracked it finally! If anyone can think of a better solution, please please please share!!! @Atkaaz. It turns out you were sort of right...less back-ticking did the trick...I still don't like the eval-ing though (defmacro def-plus-doc [name & symbs] (let [[doc & syms :as all] (ev

Re: attaching doc-string from macro is driving me insane!

2013-02-24 Thread AtKaaZ
I don't know what to tell you... basically it should be something like this (working on your first example, since I i don't wanna break my brain trying to understand the second one xD) (defmacro def-plus-doc [name doc & syms] (let [zdoc (eval doc) _ (assert (string? zdoc) (str "must be s

Re: attaching doc-string from macro is driving me insane!

2013-02-24 Thread Jim - FooBar();
I tried with eval, tried the let inside and outside the syntax-quote - I've tried everything! This is so frustrating! Jim On 24/02/13 18:24, AtKaaZ wrote: ds# inside the def is inside a ~() which means it's expected to exist outside of the ` like: (defmacro ... (let [ds# "something] `(

Re: attaching doc-string from macro is driving me insane!

2013-02-24 Thread AtKaaZ
ds# inside the def is inside a ~() which means it's expected to exist outside of the ` like: (defmacro ... (let [ds# "something] `(def ~(... ds# ) )) maybe try the let block be outside of the ` ? but that means you probably need to use eval It's funny I tried the same thing like you li

attaching doc-string from macro is driving me insane!

2013-02-24 Thread Jim - FooBar();
Hi everyone, I cannot figure out for the life of me how to pass in an optional doc-string into a 'defsomething' macro and have it to work. If I hard-code it then it works just fine... (defmacro def-plus-doc [name & syms] `(def ~(with-meta name (assoc (meta name) :doc "HI!")) ~@syms)) ;;thi