PROPOSAL: Add `disjoint` method to `Data.IntSet`

Víctor López Juan victor at lopezjuan.com
Tue Dec 19 15:18:43 UTC 2017


I'm thinking that `disjoint` is already a negation:
(dis- (not) + joint (united)). When composing with `not`, the user gets
a double negation `not (disjoint x y)`. There is a then a small mental
effort required to go from "not disjoint" to "overlapping".

If we are going to have only one of the two properties, I would rather
have the positive one (`overlaps`) as primitive. Then `disjoint` would
be written "not (overlaps x y)", which reads quite easily.
(Or even "not (x `overlaps` y)").

— Víctor

Den 2017-12-19 kl. 16:01, skrev Joachim Breitner:
> Hi,
> 
> Am Dienstag, den 19.12.2017, 13:44 +0100 schrieb Andreas Abel:
>> +1 for "disjoint".
> 
> 
> +1 
> 
>> I think "overlaps" falls below the Fairbairn threshold. 
> 
>> 
>>  I always 
>> wondered why there is a "notMember" function in the Set interface, 
>> saving us 3 key presses.
> 
> Probably because of use like this:
> 
>    filter (`notMember` seen) todo            -- pretty
> 
> vs.
> 
>    filter (not . (`member` seen)) todo       -- too many parenthesis.
> 
> Of course 
> 
>    filter (\x -> not (x `member` seen)) todo -- is also ok
> 
> And I will refrain from pointing out that with the idea of no-white-
> space-means-higher-precedence[1] would allow
> 
>    filter (not . `member`seen) todo          -- too many parenthesis.
> 
> 
> [1] https://www.joachim-breitner.de/blog/730-Less_parentheses
> 
>>  One thing to consider: Data.Set should then also be equipped with a 
>> function "disjoint", to keep interfaces in sync.
> 
>> 
> Cheers,
> Joachim
> 
> 
> 
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20171219/0b7568ed/attachment.sig>


More information about the Libraries mailing list