Re: - vs - and names vs anonymous function

2011-11-04 Thread Stefan Kamphausen
Thanks for pointing my error out. I was not only oversimplifying things, worse, I simplified something away that was crucial to the original question. Regards Stefan -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email

Re: - vs - and names vs anonymous function

2011-11-03 Thread Laurent PETIT
2011/11/2 Stefan Kamphausen ska2...@googlemail.com: Hi, while all the other answers already offered explanations and solutions I feel like I should add, that macros like - and - work on the source-code. Not quite. Macros work on Clojure data structures returned by the Clojure Reader (so

Re: - vs - and names vs anonymous function

2011-11-03 Thread Alan Malloy
As a nice result of this, you can easily see what the problem is simply by quoting the form: this resolves reader macros but leaves the form otherwise unevaluated, so you can determine what forms the - macro is working with: user '(- x #(inc %)) (- x (fn* [p1__4781#] (inc p1__4781#))) user

- vs - and names vs anonymous function

2011-11-02 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi there, i stumbled over two odd things 1) - and - have the same source code. why is that? 2) why can't i use (- hi #(println %)) directly? why do i have to put my function into a symbol first? is there a way to avoid this? (let [dummy #(println

Re: - vs - and names vs anonymous function

2011-11-02 Thread Jonas
On Wednesday, November 2, 2011 11:37:32 AM UTC+2, HamsterofDeath wrote: hi there, i stumbled over two odd things 1) - and - have the same source code. why is that? Similar, but not the same [1]: (~(first form) ~x ~@(next form)) vs. (~(first form) ~@(next form) ~x) 2) why can't i use (-

Re: - vs - and names vs anonymous function

2011-11-02 Thread Baishampayan Ghose
i stumbled over two odd things 1) - and - have the same source code. why is that? The source code is _not_ the same for the two macros you mentioned. I will leave it to you to spot the differences ;-) 2) why can't i use (- hi #(println %)) directly? why do i have to put my function into a

Re: - vs - and names vs anonymous function

2011-11-02 Thread Matt Hoyt
...@googlemail.com To: clojure@googlegroups.com Sent: Wednesday, November 2, 2011 4:37 AM Subject: - vs - and names vs anonymous function -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi there, i stumbled over two odd things 1) - and - have the same source code. why is that? 2) why can't i use (- hi #(println

Re: - vs - and names vs anonymous function

2011-11-02 Thread Brian Mosley
On Wed, Nov 2, 2011 at 5:37 AM, Dennis Haupt d.haup...@googlemail.com wrote: i stumbled over two odd things 1) - and - have the same source code. why is that? - and - are macros that have similar purposes. - inserts the previous form as the first argument to the function, - inserts it as the

Re: - vs - and names vs anonymous function

2011-11-02 Thread Stefan Kamphausen
Hi, while all the other answers already offered explanations and solutions I feel like I should add, that macros like - and - work on the source-code. So using - does not mean 'pass the first thing as an argument to the function call in the second thing', it means 'take the first thing and

Re: - vs - and names vs anonymous function

2011-11-02 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 thx *note: use macroexpand next time* Am 02.11.2011 10:58, schrieb Jonas: On Wednesday, November 2, 2011 11:37:32 AM UTC+2, HamsterofDeath wrote: hi there, i stumbled over two odd things 1) - and - have the same source code. why is that?

Re: - vs - and names vs anonymous function

2011-11-02 Thread Brian Mosley
On Wed, Nov 2, 2011 at 6:12 AM, Dennis Haupt d.haup...@googlemail.com wrote: so - and - behave the same as long as my functions only take one parameter? They do if you avoid inline function definitions. -- You received this message because you are subscribed to the Google Groups Clojure