Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #31253
| From | Doc O'Leary <droleary@2015usenet1.subsume.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: How would you prepare for javascripting interview? |
| Date | 2016-09-06 16:48 +0000 |
| Organization | Subsume Technologies, Inc. |
| Message-ID | <nqms14$v6r$1@dont-email.me> (permalink) |
| References | (8 earlier) <nqhg6o$st6$1@dont-email.me> <number-20160904224527@ram.dialup.fu-berlin.de> <87h99vz2lp.fsf@bsb.me.uk> <nqk9ug$kms$1@dont-email.me> <87zinmxis5.fsf@bsb.me.uk> |
For your reference, records indicate that Ben Bacarisse <ben.usenet@bsb.me.uk> wrote: > Doc O'Leary <droleary@2015usenet1.subsume.com> writes: > > > For your reference, records indicate that > > Ben Bacarisse <ben.usenet@bsb.me.uk> wrote: > > > >> I don't think anyone is wondering *why* Math.max() = -Infinity so much > >> as whether it should be anything at all. > > > > Or, more to the point, why it isn’t defined as something that is > > *conceptually consistent* with other methods for calculating it, > > including how it might be treated for other data types. > > > > For example, if you put the numbers in an array, you might be > > tempted to use something like reduce() to get down to the min/max > > value. Try that on an empty array and you get a TypeError. If you > > instead think of it as a sort() followed by an unshift() or pop(), > > trying to do it that way on an empty array returns undefined. > > These are valid points (though you can reduce an empty array provided > you specify the "identity"). Yes, you can reduce it to *anything* if you supply that anything! We both know the issue is bigger than that. > But I wonder if you feel the same about: > > > [].every(x=>x) > true > > [].some(x=>x) > false I would say there should *definitely* have been a debate on those choices as default values, too. At a higher level, it doesn’t make sense to say that something is true for *every* object in a collection, but it is *not* true for some of them. > And would you object to [].sum() being 0 and [].product being 1? (I > know ECMAScript has neither, I'm just interested in how you see similar > situations.) A sum does essentially start at zero, so I have no objection to that. I don’t know any mathematical concept of a product that can similarly be said to have a set value. > I was with you up to this point. The infinity is not pulled out of > nowhere -- there's a reason for it, even if you don't think it's a good > one (or a good enough one). And even if you disagree with the choice, > it's certainly not a hack, and defending it is no reason be barred from > working with JavaScript. Sorry, but it’s just a dirty hack. It’s used as the default value simply because the implementation makes it a convenient comparison, what with *any* value being greater than -Infinity (or the opposite for min). But any actual thought to the *meaning* of the operations would lead any competent developer to a different solution, and one that provides a sensible result for an empty set *regardless* of the type of object that it contains none of. -- "Also . . . I can kill you with my brain." River Tam, Trash, Firefly
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How would you prepare for javascripting interview? justaguy <lichunshen84@gmail.com> - 2016-07-18 09:10 -0700
Re: How would you prepare for javascripting interview? Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2016-07-18 18:37 +0200
Re: How would you prepare for javascripting interview? justaguy <lichunshen84@gmail.com> - 2016-07-18 11:09 -0700
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-07-21 01:04 +0000
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-07-21 14:24 +0100
Re: How would you prepare for javascripting interview? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-23 16:25 +0200
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-07-23 15:56 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-03 19:39 +0000
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-04 15:56 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-05 00:06 +0100
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-05 14:49 +0100
Re: How would you prepare for javascripting interview? $Bill <news@todbe.com> - 2016-09-05 10:01 -0700
Re: How would you prepare for javascripting interview? Gene Wirchenko <genew@telus.net> - 2016-09-06 09:36 -0700
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-05 15:05 +0100
Re: How would you prepare for javascripting interview? Andreas Bergmaier <andber93@web.de> - 2016-09-05 20:31 +0200
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-06 15:15 +0000
Re: How would you prepare for javascripting interview? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-09-06 19:40 +0200
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-06 19:25 +0100
Re: How would you prepare for javascripting interview? Andreas Bergmaier <andber93@web.de> - 2016-09-06 22:16 +0200
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-07 17:17 +0100
Re: How would you prepare for javascripting interview? Andreas Bergmaier <andber93@web.de> - 2016-09-07 20:07 +0200
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-08 14:36 +0100
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-05 18:46 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-05 20:32 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-05 17:27 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-05 20:12 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-06 16:48 +0000
Re: How would you prepare for javascripting interview? Andreas Bergmaier <andber93@web.de> - 2016-09-06 19:56 +0200
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-07 20:16 +0000
Re: How would you prepare for javascripting interview? Gene Wirchenko <genew@telus.net> - 2016-09-07 10:01 -0700
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-07 20:21 +0000
Re: How would you prepare for javascripting interview? Gene Wirchenko <genew@telus.net> - 2016-09-09 11:41 -0700
Re: How would you prepare for javascripting interview? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-09 15:35 -0700
Re: How would you prepare for javascripting interview? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-09 20:40 -0700
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-10 15:12 +0000
Re: How would you prepare for javascripting interview? Gene Wirchenko <genew@telus.net> - 2016-09-12 11:14 -0700
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-13 21:07 +0000
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-06 16:20 +0000
Re: How would you prepare for javascripting interview? Ken Tilton <kentilton@gmail.com> - 2016-09-05 11:37 -0700
Re: How would you prepare for javascripting interview? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-09-06 19:26 +0200
Re: How would you prepare for javascripting interview? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-09-08 12:41 -0700
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-05 20:37 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-05 22:13 +0100
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-06 02:33 +0000
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-06 16:02 +0000
Re: How would you prepare for javascripting interview? Gene Wirchenko <genew@telus.net> - 2016-09-06 09:50 -0700
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-07 01:36 +0000
Re: How would you prepare for javascripting interview? Gene Wirchenko <genew@telus.net> - 2016-09-07 10:07 -0700
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-10 00:03 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-10 00:12 +0000
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-10 15:34 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-11 01:32 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-12 19:26 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-13 01:02 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-13 21:38 +0000
Re: How would you prepare for javascripting interview? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-09-14 00:56 +0200
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-15 15:09 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-14 00:47 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-15 15:34 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-11 02:45 +0000
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-12 19:10 +0000
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-12 21:06 +0100
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-07 03:12 +0000
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-07 19:53 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-10 02:14 +0000
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-10 11:25 +0100
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-10 15:49 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-10 18:39 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-11 02:45 +0000
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-11 16:23 +0100
Re: How would you prepare for javascripting interview? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-12 20:32 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-12 18:49 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-13 00:27 +0000
Re: How would you prepare for javascripting interview? Tim Streater <timstreater@greenbee.net> - 2016-09-13 08:51 +0100
Re: How would you prepare for javascripting interview? Jon Ribbens <jon+usenet@unequivocal.eu> - 2016-09-13 12:33 +0000
Re: How would you prepare for javascripting interview? Scott Sauyet <scott@sauyet.com> - 2016-09-14 01:17 +0000
Re: How would you prepare for javascripting interview? Tim Streater <timstreater@greenbee.net> - 2016-09-14 11:15 +0100
Re: How would you prepare for javascripting interview? Doc O'Leary <droleary@2015usenet1.subsume.com> - 2016-09-15 15:02 +0000
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-13 10:06 +0100
Re: How would you prepare for javascripting interview? John Harris <niam@jghnorth.org.uk.invalid> - 2016-09-06 19:53 +0100
Re: How would you prepare for javascripting interview? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-18 22:30 +0200
Re: How would you prepare for javascripting interview? justaguy <lichunshen84@gmail.com> - 2016-07-18 14:56 -0700
Re: How would you prepare for javascripting interview? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2016-07-19 16:01 -0300
Re: How would you prepare for javascripting interview? Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2016-07-19 16:16 -0300
csiph-web