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 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 ; => {... :result-a ...}
> e ; use :result-a
>
> This technique is brought up in:
> http://www.infoq.com/presentations/Thinking-in-Data
>
> Jonathan
>
> On Fri, Oct 26, 2012 at 4:43 AM, Ben Mabey <b...@benmabey.com<javascript:>
> > wrote:
>
>> 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 extention of that file). How would I drop a let into 
>>> the middle of the thread calls without making a large mess? The only 
>>> suggestion I've gotten so far is to move calls A and B into a let before 
>>> the thread-first so I can process their return values.
>>>
>>> jason
>>>
>>
>> Pallet's thread-exp library has a let-> macro that would do the trick:
>>
>> https://github.com/pallet/**thread-expr/blob/develop/src/**
>> pallet/thread_expr.clj#L100-**106<https://github.com/pallet/thread-expr/blob/develop/src/pallet/thread_expr.clj#L100-106>
>>
>> I love the thread-expr library but when I spoke with Hugo Duncan at 
>> Clojure West he said that pallet's use of it was largely being replaced by 
>> monads.
>>
>> -Ben
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@**googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/**group/clojure?hl=en<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

Reply via email to