Clojure embraces this "laziness":

user=> (get #{:foo :bar} :foo)
:foo

'get uses a "key" to return a "value".  A vector is not a map is not a
set, but all of them can have their values accessed in constant-time
using a "key".


On Apr 30, 3:14 pm, "Steven E. Harris" <s...@panix.com> wrote:
> Phil Hagelberg <p...@hagelb.org> writes:
> > Actually I do consider sets to have keys, since internally they are
> > implemented using maps, so the exact same semantics apply for their
> > lookup. They're just maps where the key and value are the same thing:
>
> But that implementation is one of convenience, of possibly admirable
> laziness, and it's none of our business. A key is something apart from a
> value it refers, but in sets, there's no separate value being referred
> to. The value is the only thing in play.
>
> Where we get hung up in software is with the flexibility to define
> "equality" or "sufficient sameness" in set implementations by taking
> only part of the stored values into account. The same idea doesn't exist
> in the mathematical view of sets. Our software would be much clearer if
> sets didn't tolerate these "key comparison views", and would instead
> force one to use a map in cases where such a "key comparison view"
> (being something less than the value itself) is necessary.
>
> --
> Steven E. Harris
>
> --
> 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 
> athttp://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