Iterating through the pairs is useful.  Asking if a given [k, v] is
included is not - you can just ask if (= (assoc k) v) instead.

It'd be nice if (contains-val) returned the key(s) as its true result,
but probably not useful enough to warrant the complexity of dealing
with false keys, explicit true checks, etc.  In CL I would totally
return the key list as a multivalue on top of t, though. :)

On Thursday, April 29, 2010, Boris Mizhen - 迷阵 <[email protected]> wrote:
>> +1. I can't imagine any use case for looking up a whole [key, value] pair in 
>> a hash-map.
> Actually this is quite useful when you want to do something for each
> value and need to know the key as well - for example copy some
> key/value pairs to another map
>
> Boris
>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to [email protected]
>> Note that posts from new members are moderated - please be patient with your 
>> first post.
>> To unsubscribe from this group, send email to
>> [email protected]
>> 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 post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
Mark J. Reed <[email protected]>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to