Re: Proposal: SuperSet

2019-07-09 Thread 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  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ıç  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 Григорий Карелин 
>> wrote:
>>
>>> Maybe add those methods into Set instead of creating new type?
>>>
>>> On Tue, 9 Jul 2019 at 23:02, Oğuz Kılıç  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
 es-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es-discuss

>>> --
>>> Отправлено с мобильного устройства
>>>
>> ___
>> es-discuss mailing list
>> es-discuss@mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Proposal: SuperSet

2019-07-09 Thread 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ıç  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 Григорий Карелин 
> wrote:
>
>> Maybe add those methods into Set instead of creating new type?
>>
>> On Tue, 9 Jul 2019 at 23:02, Oğuz Kılıç  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
>>> es-discuss@mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>> --
>> Отправлено с мобильного устройства
>>
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Proposal: SuperSet

2019-07-09 Thread 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 Григорий Карелин  wrote:

> Maybe add those methods into Set instead of creating new type?
>
> On Tue, 9 Jul 2019 at 23:02, Oğuz Kılıç  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
>> es-discuss@mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
> --
> Отправлено с мобильного устройства
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Proposal: SuperSet

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

On Tue, 9 Jul 2019 at 23:02, Oğuz Kılıç  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
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-- 
Отправлено с мобильного устройства
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Proposal: SuperSet

2019-07-09 Thread 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
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Re: Removing the space in `a+ +b`?

2019-07-09 Thread ViliusCreator
Lexer already sees `++` as operator, not `+` operator**s**. It can be hard to 
implement something like that.
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Proposal: `Array.prototype.chunks` and `Array.prototype.windows`

2019-07-09 Thread Cyril Auburtin
Nice,
https://github.com/tc39/proposal-slice-notation/issues/19#issuecomment-421453934
is
really awesome. I hope this idea doesn't get abandoned

I feel you can swap things easily already;
```js
let x = 1, y = 2;
[x, y] = [y, x];
```

Chunks could be written
```js
// take chunks of 4 from arr
// with slice+range operator proposal
const chunks = [0:Math.ceil(arr.length/4)].map(i => arr[4*i:4*(i+1)])
// vs
const chunks = Array.from({length: Math.ceil(arr.length/4)}, (_,i) =>
arr.slice(4*i, 4*(i+1)))
```


On Tue, May 28, 2019 at 12:05 PM Joseph Rocca 
wrote:

> Apologies if this has already been suggested and discussed somewhere, but
> I couldn't find anything. I'm learning Rust at the moment, and found myself
> wishing that JavaScript had `chunks` and `windows` array methods.
>
> https://doc.rust-lang.org/std/primitive.slice.html#method.windows
>
> https://doc.rust-lang.org/std/primitive.slice.html#method.chunks
>
> A `swap` method (like Rust's) might be handy too. Has there been any
> discussion on new array methods like this? I think it's great that slice
> notation and range() type stuff
> 
>  is
> being discussed, and I think it would be neat if JavaScript got some more
> array-manipulation features to make wrangling data more pleasant.
>
> Any thoughts?
>
> Cheers,
> Joe
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss