Re: my newbie question...

2011-01-12 Thread Sean Corfield
On Wed, Jan 12, 2011 at 8:04 PM, Alex Baranosky
 wrote:
> -> and ->> do the same things, except -> threads through the first argument
> of the functions, and ->> threads through the second argument.

->> threads through the last argument.

Both macros are useful for unnesting complex expressions. There's a
good example in the comments (from Rich himself) on this blog post:

http://www.innoq.com/blog/st/2009/12/clojurelisp_readability.html
-- 
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

-- 
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


Re: my newbie question...

2011-01-12 Thread Alex Baranosky
Oops.  Sorry, I'm clearly too tired to post.  Thsoe examples aren't quite
right.

Those are the threading macros.

(-> one two three) expands to  (three (two one))

-> and ->> do the same things, except -> threads through the first argument
of the functions, and ->> threads through the second argument.

Much better (and correct) examples are here:
http://clojuredocs.org/clojure_core/clojure.core/-%3E

and

here:
http://clojuredocs.org/clojure_core/clojure.core/-%3E%3E

-- 
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

Re: my newbie question...

2011-01-12 Thread Alex Baranosky
-> and --> are macros in clojure.core, both

(-> one #(two % "a") three)
(->> one #(two "a" %) three)

expands to

(three #(two one "a"))

and (->> one #(two %1 %2) three)

expands to
(three #(two "a" one))



On Wed, Jan 12, 2011 at 10:40 PM, Sean Allen wrote:

> So i've used this because I picked it up from numerous tutorials but I've
> never really understood it,
> can I get a some decent background information on ->> and ->?
>
> I picked them up from compojure tutorials and don't feel anywhere near
> comfortable enough w/
> what is actually going on.
>
> Thanks.
>
> -Sean-
>
>
>  --
> 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

my newbie question...

2011-01-12 Thread Sean Allen
So i've used this because I picked it up from numerous tutorials but I've
never really understood it,
can I get a some decent background information on ->> and ->?

I picked them up from compojure tutorials and don't feel anywhere near
comfortable enough w/
what is actually going on.

Thanks.

-Sean-

-- 
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