Re: Numeric Array prototypes

2018-11-22 Thread T.J. Crowder
On Thu, Nov 22, 2018 at 3:48 AM kai zhu wrote: > the spread operator was a mistake. It's neither an operator nor a mistake. Again, please stop wasting the list's time with re-litigating decisions that have been made. -- T.J. Crowder ___ es-discuss

Re: Numeric Array prototypes

2018-11-21 Thread MichaƂ Wadas
On side note, it would be beneficial to have selection in standard library. This would cover median, min and max cases. http://stevehanov.ca/blog/index.php?id=122 On Thu, 22 Nov 2018, 07:36 Isiah Meadows No, I'm referring to how it'd be implemented. JS implementations might > choose to leverage

Re: Numeric Array prototypes

2018-11-21 Thread Isiah Meadows
No, I'm referring to how it'd be implemented. JS implementations might choose to leverage native vector CPU instructions in their code gen to speed them up by a factor of 1.5-3. - Isiah Meadows cont...@isiahmeadows.com www.isiahmeadows.com On Wed, Nov 21, 2018 at 9:51 PM Gbadebo Bello

Re: Numeric Array prototypes

2018-11-21 Thread kai zhu
sorry for derailing, i just have many tooling/operational gripes on es6 (and reminding of past mistakes so they're not repeated is not necessarily bad thing). but yea max, min, mean (and maybe sumOfSquares), are common-enough array-tasks they would be useful as optimized (maybe also

Re: Numeric Array prototypes

2018-11-21 Thread Jordan Harband
Python and JSLint aren't in any way the arbiters of what's idiomatic in JS; webpack is not a minifier, it's a bundler; I believe uglify-es exists, but most people use babel and uglify, in my experience, which work fine. Please don't derail this thread about numeric methods on array prototypes

Re: Numeric Array prototypes

2018-11-21 Thread kai zhu
@gbadebo, no he's talking about vectorized operations in c++ or whatever native-language the js-engine is implemented in. the spread operator was a mistake. it's redundant to Object.p.apply (violates python/jslint maxim of one-way of doing things), the syntax increases cost of maintaining

Re: Numeric Array prototypes

2018-11-21 Thread Gbadebo Bello
>An advantage to having this an internal primitive is you can use vector instructions to check 4-8 values in parallel and then end with a final step of finding the max/min value of the vector. (integers can just use bit hacks, float max/min has hardware acceleration). I don't quite understand,

Re: Numeric Array prototypes

2018-11-21 Thread Gbadebo Bello
Well, you are right. The `apply` method might not be the best(Performance wise). @T.J. Crowder. Wow, my mind didn't go to `reduce` at all, I don't have any issues with it, in fact I feel it would perform better than `apply` ___ es-discuss mailing list

Re: Numeric Array prototypes (Isiah Meadows)

2018-11-21 Thread Isiah Meadows
This reply from Gbadebo missed the list. (I confirmed in a private email.) - Isiah Meadows cont...@isiahmeadows.com www.isiahmeadows.com On Wed, Nov 21, 2018 at 7:16 PM Gbadebo Bello wrote: > > Yh, i felt the same way about the rest also but thought it would be nice to > atleast get

Re: Numeric Array prototypes (Isiah Meadows)

2018-11-21 Thread Gbadebo Bello
Yh, i felt the same way about the rest also but thought it would be nice to atleast get feedback b concluding. -- Forwarded message - From: Gbadebo Bello Date: Mon, Nov 19, 2018, 01:27 Subject: Re: Numeric Array prototypes (Isiah Meadows) To: Isiah Meadows Yh, i felt the same

Re: Numeric Array prototypes

2018-11-21 Thread Isiah Meadows
An advantage to having this an internal primitive is you can use vector instructions to check 4-8 values in parallel and then end with a final step of finding the max/min value of the vector. (integers can just use bit hacks, float max/min has hardware acceleration). The arithmetic mean could be

Re: Numeric Array prototypes

2018-11-21 Thread T.J. Crowder
On Wed, Nov 21, 2018 at 7:23 AM Isiah Meadows wrote: > > It doesn't work as well with larger collections. For example, fails at somewhere between an array of length 125,000 and 126,000 on V8 in Chrome v70 (as does the `apply` trick, so the proposed polyfill would have the same problem):

Re: Numeric Array prototypes

2018-11-20 Thread Isiah Meadows
It doesn't work as well with larger collections. Personally, it makes most sense in a standard library module On Wed, Nov 21, 2018 at 00:43 Michael Luder-Rosefield < rosyatran...@gmail.com> wrote: > > Math.min() method doesn't work on Arrays right out of the box. > > No, but rest parameters

Re: Numeric Array prototypes

2018-11-20 Thread Michael Luder-Rosefield
> Math.min() method doesn't work on Arrays right out of the box. No, but rest parameters work: Math.min(...arr) is fine, and works with Sets too. On Wed, 21 Nov 2018 at 14:08 Isiah Meadows wrote: > Not sure these belong in the standard library itself. I could see max and > min being there

Re: Numeric Array prototypes

2018-11-20 Thread Isiah Meadows
Not sure these belong in the standard library itself. I could see max and min being there (these are very broadly useful), but the others, not so much. I'd also like both max and min accept an optional comparison callback of `(a, b) => a < b`. But the rest seem too narrowly useful IMHO. On Tue,

Numeric Array prototypes

2018-11-20 Thread Gbadebo Bello
The array object has no method for finding the minimum value of an array of numbers and the Math.min() method doesn't work on Arrays right out of the box. I'll have similar issues if i wanted to return the maximum number, the mean, mode, median or standard deviations in any array of numbers.