Proposal: SuperSet

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Proposal: SuperSet

Oğuz Kılıç

As you know, the current Set feature is not sufficient in some aspects. We benefit from utility libraries or special implementations to fill this deficiency.

For example, wouldn’t it be better if we had the following approach?

UNION

X ∪ Y = { x | x ∈ X or x ∈ Y }
let first = new SuperSet(["a", "b", "c"]);
let second = new SuperSet(["b", "c", "d", "e"]);

first.union(second); //→ SuperSet { "a", "b", "c", "d", "e" }

DIFFERENCE

X - Y = { x | x ∈ X and x ∉ Y }
let nums = new SuperSet([3, 4, 5, 6]);
let primes = new SuperSet([2, 3, 5, 7]);

nums.diff(primes); // → SuperSet { 4, 6 }

INTERSECT

X ∩ Y = { x | x ∈ X and x ∈ Y }
let nums = new SuperSet([3, 4, 5, 6]);
let primes = new SuperSet([2, 3, 5, 7]);
nums.intersect(primes); // → SuperSet { 3, 5 }

DISCARD

let nums = new SuperSet([1, 2, 3, 4]);
nums.discard([1, 3]); // → SuperSet { 2, 4 }

Motivation
SuperSet - https://github.com/BYK/superset


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: SuperSet

Григорий Карелин
Maybe add those methods into Set instead of creating new type?

On Tue, 9 Jul 2019 at 23:02, Oğuz Kılıç <[hidden email]> wrote:

As you know, the current Set feature is not sufficient in some aspects. We benefit from utility libraries or special implementations to fill this deficiency.

For example, wouldn’t it be better if we had the following approach?

UNION

X ∪ Y = { x | x ∈ X or x ∈ Y }
let first = new SuperSet(["a", "b", "c"]);
let second = new SuperSet(["b", "c", "d", "e"]);

first.union(second); //→ SuperSet { "a", "b", "c", "d", "e" }

DIFFERENCE

X - Y = { x | x ∈ X and x ∉ Y }
let nums = new SuperSet([3, 4, 5, 6]);
let primes = new SuperSet([2, 3, 5, 7]);

nums.diff(primes); // → SuperSet { 4, 6 }

INTERSECT

X ∩ Y = { x | x ∈ X and x ∈ Y }
let nums = new SuperSet([3, 4, 5, 6]);
let primes = new SuperSet([2, 3, 5, 7]);
nums.intersect(primes); // → SuperSet { 3, 5 }

DISCARD

let nums = new SuperSet([1, 2, 3, 4]);
nums.discard([1, 3]); // → SuperSet { 2, 4 }

Motivation
SuperSet - https://github.com/BYK/superset

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
--
Отправлено с мобильного устройства

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: SuperSet

Oğuz Kılıç
Yes, I already consider it as an enriched version of the current set method, I just like calling it superset :)

On Tue, Jul 9, 2019 at 11:05 PM Григорий Карелин <[hidden email]> wrote:
Maybe add those methods into Set instead of creating new type?

On Tue, 9 Jul 2019 at 23:02, Oğuz Kılıç <[hidden email]> wrote:

As you know, the current Set feature is not sufficient in some aspects. We benefit from utility libraries or special implementations to fill this deficiency.

For example, wouldn’t it be better if we had the following approach?

UNION

X ∪ Y = { x | x ∈ X or x ∈ Y }
let first = new SuperSet(["a", "b", "c"]);
let second = new SuperSet(["b", "c", "d", "e"]);

first.union(second); //→ SuperSet { "a", "b", "c", "d", "e" }

DIFFERENCE

X - Y = { x | x ∈ X and x ∉ Y }
let nums = new SuperSet([3, 4, 5, 6]);
let primes = new SuperSet([2, 3, 5, 7]);

nums.diff(primes); // → SuperSet { 4, 6 }

INTERSECT

X ∩ Y = { x | x ∈ X and x ∈ Y }
let nums = new SuperSet([3, 4, 5, 6]);
let primes = new SuperSet([2, 3, 5, 7]);
nums.intersect(primes); // → SuperSet { 3, 5 }

DISCARD

let nums = new SuperSet([1, 2, 3, 4]);
nums.discard([1, 3]); // → SuperSet { 2, 4 }

Motivation
SuperSet - https://github.com/BYK/superset

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
--
Отправлено с мобильного устройства

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: SuperSet

Jordan Harband
Are you perhaps looking for https://github.com/tc39/proposal-set-methods ?

On Tue, Jul 9, 2019 at 1:18 PM Oğuz Kılıç <[hidden email]> wrote:
Yes, I already consider it as an enriched version of the current set method, I just like calling it superset :)

On Tue, Jul 9, 2019 at 11:05 PM Григорий Карелин <[hidden email]> wrote:
Maybe add those methods into Set instead of creating new type?

On Tue, 9 Jul 2019 at 23:02, Oğuz Kılıç <[hidden email]> wrote:

As you know, the current Set feature is not sufficient in some aspects. We benefit from utility libraries or special implementations to fill this deficiency.

For example, wouldn’t it be better if we had the following approach?

UNION

X ∪ Y = { x | x ∈ X or x ∈ Y }
let first = new SuperSet(["a", "b", "c"]);
let second = new SuperSet(["b", "c", "d", "e"]);

first.union(second); //→ SuperSet { "a", "b", "c", "d", "e" }

DIFFERENCE

X - Y = { x | x ∈ X and x ∉ Y }
let nums = new SuperSet([3, 4, 5, 6]);
let primes = new SuperSet([2, 3, 5, 7]);

nums.diff(primes); // → SuperSet { 4, 6 }

INTERSECT

X ∩ Y = { x | x ∈ X and x ∈ Y }
let nums = new SuperSet([3, 4, 5, 6]);
let primes = new SuperSet([2, 3, 5, 7]);
nums.intersect(primes); // → SuperSet { 3, 5 }

DISCARD

let nums = new SuperSet([1, 2, 3, 4]);
nums.discard([1, 3]); // → SuperSet { 2, 4 }

Motivation
SuperSet - https://github.com/BYK/superset

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
--
Отправлено с мобильного устройства
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: SuperSet

Oğuz Kılıç
Hi Jordan, yes.
Sorry for not looking in detail.

Thanks.

On Tue, Jul 9, 2019 at 11:32 PM Jordan Harband <[hidden email]> wrote:
Are you perhaps looking for https://github.com/tc39/proposal-set-methods ?

On Tue, Jul 9, 2019 at 1:18 PM Oğuz Kılıç <[hidden email]> wrote:
Yes, I already consider it as an enriched version of the current set method, I just like calling it superset :)

On Tue, Jul 9, 2019 at 11:05 PM Григорий Карелин <[hidden email]> wrote:
Maybe add those methods into Set instead of creating new type?

On Tue, 9 Jul 2019 at 23:02, Oğuz Kılıç <[hidden email]> wrote:

As you know, the current Set feature is not sufficient in some aspects. We benefit from utility libraries or special implementations to fill this deficiency.

For example, wouldn’t it be better if we had the following approach?

UNION

X ∪ Y = { x | x ∈ X or x ∈ Y }
let first = new SuperSet(["a", "b", "c"]);
let second = new SuperSet(["b", "c", "d", "e"]);

first.union(second); //→ SuperSet { "a", "b", "c", "d", "e" }

DIFFERENCE

X - Y = { x | x ∈ X and x ∉ Y }
let nums = new SuperSet([3, 4, 5, 6]);
let primes = new SuperSet([2, 3, 5, 7]);

nums.diff(primes); // → SuperSet { 4, 6 }

INTERSECT

X ∩ Y = { x | x ∈ X and x ∈ Y }
let nums = new SuperSet([3, 4, 5, 6]);
let primes = new SuperSet([2, 3, 5, 7]);
nums.intersect(primes); // → SuperSet { 3, 5 }

DISCARD

let nums = new SuperSet([1, 2, 3, 4]);
nums.discard([1, 3]); // → SuperSet { 2, 4 }

Motivation
SuperSet - https://github.com/BYK/superset

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
--
Отправлено с мобильного устройства
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss