Re: Threading macro with support for conditionals

2012-01-10 Thread Miikka Miettinen
Thanks, I'll take a look at pallet. And thanks also to Tassilo for the suggestion to use anonymous functions. --Miikka On Jan 10, 2012, at 4:36 PM, Sam Ritchie wrote: > Mikka, > > The pallet/thread-expr library has the macros you're looking for: > > https://github.com/pallet/thread-expr > >

Re: Threading macro with support for conditionals

2012-01-10 Thread Sam Ritchie
Mikka, The pallet/thread-expr library has the macros you're looking for: https://github.com/pallet/thread-expr These would allow you to write: (use 'pallet.thread-expr) (-> {} (status code) (content-type "application/json;charset=utf-8") (when-> (= error-type :unauthorized) (head

Re: Threading macro with support for conditionals

2012-01-10 Thread Tassilo Horn
Miikka Miettinen writes: Hi Miikka, > I sometimes find myself wanting to write simple conditional > expressions inside -> and ->>. For example, it would be nice to create > Ring responses like this: > > (-> {} > (status code) > (content-type "application/json;charset=utf-8") > (when

Threading macro with support for conditionals

2012-01-10 Thread Miikka Miettinen
Hi, I sometimes find myself wanting to write simple conditional expressions inside -> and ->>. For example, it would be nice to create Ring responses like this: (-> {} (status code) (content-type "application/json;charset=utf-8") (when (= error-type :unauthorized) (header "WWW-A