Personal preference. It causes less mental load because it more obviously 
spells out what you are doing.

On Thursday, March 21, 2013 4:58:08 PM UTC+1, Ryan wrote:
>
> Thanks a lot Marko. Much better now :)
>
> I also wanted to ask you why did you mention in a previous post that you 
> prefer using *remove *than *filter + complement*. Is there a reason for 
> this or just a personal preference?
>
> Ryan
>
> On Thursday, March 21, 2013 5:37:33 PM UTC+2, Marko Topolnik wrote:
>>
>> First we build a set of all the keys in *list-b*: 
>>
>> (into #{} (map key-fn list-b))
>>
>> Let's call that set *keyset-b. *Then we use *keyset-b* as a function 
>> which returns truthy (non-nil) for any key that is contained in it, and 
>> compose it with our *key-fn*:
>>
>> (comp keyset-b key-fn)
>>
>> This results in a function that first applies *key-fn*, then *keyset-b*. 
>> So it's like #(keyset-b (key-fn %)). Let's call this function *predicate*
>> .
>>
>> Finally, we use *predicate* to *remove* any member of *list-a* for which 
>> it is truthy:
>>
>> (remove predicate list-a)
>>
>> -marko
>>
>> On Thursday, March 21, 2013 4:14:46 PM UTC+1, Ryan wrote:
>>
>>> Marko,
>>>
>>> Can you please do me a favor and break down the function you suggested 
>>> me? I understand partially how it works but I am having trouble to fully 
>>> get it.
>>>
>>> (remove (comp (into #{} (map key-fn list-b)) key-fn) list-a)
>>>>
>>>

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