Re: Array.prototype.joinWith(iterable)

2019-08-16 Thread Naveen Chawla
I don't know what you mean by tags. I guess this is outside my experience area. I'd love to know the use case. Hope I'm not bothering you or anyone else reading this thread On Fri, 16 Aug 2019, 21:00 Jordan Harband, wrote: > Can you elaborate a bit more on how this is a *common* case in the

Re: Array.prototype.joinWith(iterable)

2019-08-16 Thread Jordan Harband
Can you elaborate a bit more on how this is a *common* case in the wider ecosystem? On Fri, Aug 16, 2019 at 5:29 AM Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > early reply "which otehr cases"? this is just an example: > > [2019, 08, 16, 14, 28, 30].map(i => i < 10 ? ('0' + i)

Re: Modulo Operator %%

2019-08-16 Thread Alex Gordon
Code that uses % is often surprisingly buggy. For example even a simple function such as this is broken if n is negative: function isOdd(n) { return n % 2 === 1; } isOdd(-3) // false The same is not true in other programming languages. The same in Python works just fine: def isOdd(n):

Re: Modulo Operator %%

2019-08-16 Thread kdex
Reply inline. On Friday, August 16, 2019 5:50:40 PM CEST peter miller wrote: > Hi, > > +1 for _at_least_ having `Math.mod()` > > And here's a reason why: > > The code `mod = (x,y) => ( ( x % y ) + y ) % y` is not only slow but > inaccurate. For example, for `mod( -24982515569.97, >

Re: Modulo Operator %%

2019-08-16 Thread peter miller
Hi, +1 for _at_least_ having `Math.mod()` And here's a reason why: The code `mod = (x,y) => ( ( x % y ) + y ) % y` is not only slow but inaccurate. For example, for `mod( -24982515569.97, -2022673516699079.8)` gives `-24982515569.75` (Chrome Version 77.0.3865.35) instead of

Re: Re: Modulo Operator %%

2019-08-16 Thread Matthew Morgan
Isiah, thank you for composing this proposal. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Array.prototype.joinWith(iterable)

2019-08-16 Thread Andrea Giammarchi
early reply "which otehr cases"? this is just an example: [2019, 08, 16, 14, 28, 30].map(i => i < 10 ? ('0' + i) : i).joinWith('--T::.'); On Fri, Aug 16, 2019 at 2:24 PM Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > `this ${Symbol('throws')} an error`, so anything that cannot

Re: Array.prototype.joinWith(iterable)

2019-08-16 Thread Andrea Giammarchi
`this ${Symbol('throws')} an error`, so anything that cannot be represented as string should throw too, as it is for `[1, 2, 3].join(Symbol())`. In few words, everything described as parameter for the `Array.prototype.join(param)` should be described as the iterable value, nothng new to add,

Re: Array.prototype.joinWith(iterable)

2019-08-16 Thread Naveen Chawla
Cool. I get it now apart from the "templated string" example. I'm not very knowledgable about templated strings but on the face it looks like 'a${x}b${y}' already inserts x and y into the string, so I'm not sure what else is happening with your proposed method? Clearly I've missed something.

Re: Array.prototype.joinWith(iterable)

2019-08-16 Thread Andrea Giammarchi
given an array, it joins it through the values of the iterable argument, without ever resulting to undefined ['a', 'b', 'c'].joinWith(['-']) would produce "a-b-c" ['a', 'b', 'c'].joinWith([1, 2]) would produce "a1b2c" ['a', 'b', 'c'].joinWith('012') would produce "a0b1c" note the string, as

Re: Array.prototype.joinWith(iterable)

2019-08-16 Thread Naveen Chawla
I'm just not seeing what it's supposed to do. If you could give a brief explanation of the array method, and the string method then of course I would get it. I know it would seem obvious to you from the examples alone, it's just not to me. On Fri, 16 Aug 2019 at 08:32, Andrea Giammarchi wrote:

Re: Array.prototype.joinWith(iterable)

2019-08-16 Thread Andrea Giammarchi
Just to re-state: zip from lowdash, does **not** do what my proposed method does ... anything that won't produce the following result is not what I'm proposing console.log(['a', 'b', 'c', 'd'].joinWith([1, 2])); // a1b2c1d function tag2str(template, ...values) { return