Appreciate everyone's responses! I'll certainly check out the let-> option.
jason
On Friday, October 26, 2012 6:16:28 AM UTC-7, Jonathan Fischer Friberg
wrote:
>
> You could also let every function take a map as input/output.
> Then, b could return a map with key :result-b or similar.
> This res
You could also let every function take a map as input/output.
Then, b could return a map with key :result-b or similar.
This result would then pass through the rest of the functions and be
accessible in e.
Like this:
a ; => {:result-a ...}
b ; => {:result-b ... :result-a ...}
...
d ; => {... :resu
On 10/25/12 6:24 PM, Jason Bennett wrote:
Let's say I have a set of thread-first calls:
(-> url
a
b
c
d
e)
And let's say that I need to process and save the result of function b
as a second parameter to function e (function b returns a file, and
function e needs the
let-> seems to rebind the same name repeatedly, so that probably wouldn't help.
You could easily create a macro that bound a new name if it encounters
a literal vector in the arguments and evaluated the remaining forms in
the context of those bindings:
(somevariantof-> url
a
[file b]
I haven't tried them, but you may be in luck for Clojure 1.5.
https://github.com/clojure/clojure/commit/026691e2f6cc8d1bab4feb7e577530a9f06fd85e
Thanks,
Ambrose
On Fri, Oct 26, 2012 at 8:24 AM, Jason Bennett wrote:
>
> Let's say I have a set of thread-first calls:
>
> (-> url
> a
> b
Let's say I have a set of thread-first calls:
(-> url
a
b
c
d
e)
And let's say that I need to process and save the result of function b as a
second parameter to function e (function b returns a file, and function e
needs the extention of that file). How would I drop a