On Fri, Jan 24, 2014 at 12:56 PM, Cedric Greevey <cgree...@gmail.com> wrote:

> An interesting question this raises is if there is any sensible way to
> define (intersection). It would need to behave as an identity element for
> intersection, so would need to behave as a set (so, (set? (intersection))
> => truthy) that contained everything (so, (contains? (intersection) foo) =>
> foo no matter what foo is; (partial contains? (intersection)) => identity).
> The problem would be what to do with seq? Ideally an infinite seq that will
> produce any particular value after finite time would be produced, but
> there's no way to sensibly produce "any particular value" given the wide
> variety of constructor semantics, builders, factory methods, things not
> known to this particular runtime instance but that conceptually exist
> somewhere, etc.; of course, the seq return is a dummy of sorts anyway since
> you couldn't really use it sensibly to it might as well just return
> (range). Printing should likely be overridden to just print
> "(intersection)" rather than b0rk the REPL with a neverending stream of
> integers (or whatever).
>

Why should printing be overridden? If I print (range) I don't get "(range)".

Also, contains? returns true if the first argument contains the second, not
the second; (partial contains? (intersection)) => (constantly true).


> But then it also subtly violates another property of Clojure set objects:
> if (= a b), (not (identical? a b)), and (identical? (a-set a) a), then
> (identical? (a-set b) a) and thus (not (identical? (a-set b) b)). The
> latter is true under the hypothesis for every "real" set but would be false
> for (intersection).
>

Is this a real property of Clojure's sets or an artifact of their present
implementation? Is it something that anything impleneting IPersistentSet
has to promise to uphold?

-- 
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure."
[Larousse, "Drink" entry]

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