Your example could be written:
(-> foo
bar
(baz quuz)
blah)
But I suspect you meant something like this:
(-> foo
bar
(as-> <> (baz whiz <> quuz))
blah)
In other words, you use as-> with -> for just those cases where you
need something that isn't in the first or last argument position.
That's why it's (as-> expr name & forms) with the expression in the
first argument position.
Sean
On Tue, Aug 20, 2013 at 6:52 PM, Ken Restivo <[email protected]> wrote:
> I like the as-> macro, mostly because it'd theoretically obviate the need to
> include the Swiss Arrows library anymore.
>
> There's one reason why I keep going back to Swiss Arrows though: the ability
> to include single-arg functions in the chain that do not have the explicit
> token.
>
> i.e. in Swiss Arrows, I can do:
>
> (-<> foo
> bar
> (baz <> quux)
> blah)
>
> Note, it's clean and simple, no need for a bunch of noise and <>'s where not
> needed, only when calling functions with arity > 1.
>
> But with as->, I have to do:
>
> (as-> <> foo
> (bar <>)
> (baz <> quux)
> (blah <>))
>
> And that just seems unnecessarily noisy to me.
>
>
> Would love it if as-> allowed removing unnecessary characters, this way:
>
> (as-> <> foo
> bar
> (baz <> quux)
> blah)
>
>
> Anyway, very minor quibble, just putting it out there.
>
> Thanks.
>
> -ken
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.