In addition to clj-time, I tend to use -> with date-clj as well:

(-> (today)
    (subtract 30 :days))

And I find something like this:

        (->> (-> response :body :postalCodes)
             (map to-location) (sort-by :city))

much easier to read than:

    (sort-by :city (map to-location (:postalCodes (:body response))))

YMMV tho'...

On Mon, Mar 11, 2013 at 10:27 AM, Travis Vachon <travis.vac...@gmail.com> wrote:
> -> can also be used in conjunction with a well designed DSL to
> construct values in a very readable fashion. clj-time has some great
> examples of this:
>
>
> http://seancorfield.github.com/clj-time/doc/clj-time.core.html#var-from-now
> (-> 30 minutes from-now)
>
> http://seancorfield.github.com/clj-time/doc/clj-time.core.html#var-ago :
> (-> 5 years ago)
>
> Note that this takes advantage of the fact that (-> 30 minutes
> from-now) is equivalent to (-> 30 (minutes) (from-now))
>
> t
>
> On Mon, Mar 11, 2013 at 12:29 PM, Fogus <mefo...@gmail.com> wrote:
>> I wrote a post about -> and ->> a few years ago that might be helpful.
>> http://blog.fogus.me/2009/09/04/understanding-the-clojure-macro/
>>
>> --
>> --
>> 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 unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> 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 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to