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
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> (m
2011/11/2 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.
Not quite. Macros work on Clojure data structures returned by the
Clojure Reader (so reader-macros have
On Wed, Nov 2, 2011 at 6:12 AM, Dennis Haupt 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" group.
To post to this
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
so -> and ->> behave the same as long as my functions only take one
parameter?
Am 02.11.2011 10:58, schrieb Matt Hoyt:
> First question answer:
>
> The code isn't the same. The ~x is the first argument for -> and
> is the last argument for ->>. So
-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. w
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 an
On Wed, Nov 2, 2011 at 5:37 AM, Dennis Haupt 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 last.
> 2)
First question answer:
The code isn't the same. The ~x is the first argument for -> and is the last
argument for ->>. So if you do a long chain of expression the first argument
is passed into the return value into the next function with -> and ->> pass
that value as the last parameter.
Secon
> 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 functio
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
11 matches
Mail list logo