Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #32361

Re: Handling multiple results from combinations

Path csiph.com!news.mixmin.net!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Handling multiple results from combinations
Date Thu, 26 Jan 2017 23:21:07 +0100
Organization PointedEars Software (PES)
Lines 35
Message-ID <1771290.oMNUckLgyt@PointedEars.de> (permalink)
References <B9OdnUTUM9EuUBvFnZ2dnUU7-dnNnZ2d@westnet.com.au> <Beu5S02dqSiYFwq1@invalid.uk.co.demon.merlyn.invalid> <874e7957-7f2f-48f1-8083-e3b653f46797@googlegroups.com>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1485469268 13515 eJwNysEBwCAIA8CVRCDCOAWa/UfQe58rBH0MDnM6Fas0x1qrcfbOQHBUi8k/8oX9iXnI8reGFxE5ELo= (26 Jan 2017 22:21:08 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Thu, 26 Jan 2017 22:21:08 +0000 (UTC)
User-Agent KNode/4.14.2
X-NNTP-Posting-Host eJwFwQkBwCAMA0BLBZpkyKGffwm7w+Fiygk6BnNDn4svd8kUR52hZUCT1I68Yr8yR0fa1A8UXxE8
Cancel-Lock sha1:84YMnNTEVqNGd2O9DyADrnBksxs=
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
X-User-ID eJwNxsEBwCAIA8CVQAjIOBJx/xHaex0sNJgeCMfDs6bcSM7OU2aOY9kCrT1sVC9hlQvPH1FfFyNVHdtpMz0fSAYVXA==
Xref csiph.com comp.lang.javascript:32361

Show key headers only | View raw


Michael Haufe (TNO) wrote:

> Dr J R Stockton wrote:
>> You could maybe concatenate the booleans in a string as illustrated by
>>         var Q = "F" + +(1==1) + +(1==2) + +(1!=2)
>> then write functions for each case - function F101() { ... } for that -
>> and then merely execute   window[Q]()   // !!!     untested.  Lo, not an
>> "if" in sight.
> 
> Might as well use a Bit Mask then [1] ...

A bit mask is something slightly different.  A bit _Map_ (sic) and bitwise 
operations is what I would use as a start, with names for the bits to keep 
it easily maintainable.  However, Ben’s string approach is interesting too, 
as it has the advantage over bitwise operations that it works for more than 
32 selectors¹, basically an infinite number of them (same principle as 
arbitrary-precision arithmetic).

_______
¹  This is not obvious from what you referred to: Bitwise operations are 
   limited to 32-bit integers (ES 2016, § 12.13), so even though you can
   store integers precisely natively up to including 2⁵³ (ES 2016,
   § 20.1.2.6), you cannot reasonably use all of those in bitwise
   operations.

   Apropos powers of 2, since last year (2016) ECMAScript has an 
   exponentiation operator: 2 ** 53 === Math.pow(2, 53), specified in
   ES 2016, § 20.2.2.26 and 12.7.3.4.  I found that out by accident in the
   DevTools console this week when testing possible solutions and being
   surprised that the typo “**” did not result in a SyntaxError exception.
-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Handling multiple results from combinations Andrew Poulos <ap_prog@hotmail.com> - 2017-01-24 14:44 +1100
  Re: Handling multiple results from combinations Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-24 05:34 +0100
    Re: Handling multiple results from combinations Andrew Poulos <ap_prog@hotmail.com> - 2017-01-24 16:54 +1100
      Re: Handling multiple results from combinations Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-24 07:14 +0100
  Re: Handling multiple results from combinations "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-01-23 22:31 -0800
    Re: Handling multiple results from combinations "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-24 11:27 +0100
      Re: Handling multiple results from combinations "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-01-24 16:41 -0800
        Re: Handling multiple results from combinations "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-25 11:17 +0100
          Re: Handling multiple results from combinations "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-01-25 05:19 -0800
            Re: Handling multiple results from combinations "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-01-25 06:25 -0800
            Re: Handling multiple results from combinations "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-25 17:37 +0100
              Re: Handling multiple results from combinations "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-01-25 08:47 -0800
  Re: Handling multiple results from combinations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-24 14:22 +0000
  Re: Handling multiple results from combinations Doc O'Leary  <droleary@2015usenet1.subsume.com> - 2017-01-24 20:17 +0000
    Re: Handling multiple results from combinations "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-01-24 16:47 -0800
  Re: Handling multiple results from combinations Dr J R Stockton <reply1700@merlyn.demon.co.uk.invalid> - 2017-01-25 22:45 +0000
    Re: Handling multiple results from combinations "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-01-25 17:53 -0800
      Re: Handling multiple results from combinations Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-26 23:21 +0100

csiph-web