Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #32332
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Handling multiple results from combinations |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <B9OdnUTUM9EuUBvFnZ2dnUU7-dnNnZ2d@westnet.com.au> <ffb15942-c460-4fad-8164-7b504ee1b4df@googlegroups.com> <XnsA707747F1A2D9eejj99@194.109.6.166> <067006f4-6190-416d-a1e6-25b4a718b4b4@googlegroups.com> |
| Date | 2017-01-25 11:17 +0100 |
| Message-ID | <XnsA70872D131AFFeejj99@194.109.6.166> (permalink) |
"Michael Haufe (TNO)" <tno@thenewobjective.com> wrote on 25 Jan 2017 in
comp.lang.javascript:
> Evertjan. wrote:
>
>> Okay, so in JS:
>>
>> <script type='text/javascript'> 'use strict'
>>
>> // true/false list for a [5 variable] Karnaugh map
>> let a = 1;
>> let b = 1;
>> let c = 1;
>> let d = 0;
>> let e = 0;
>>
>> // Karnaugh resultarray 2*5 = 32
>> // members may be any [executable?] text
>> let k = ['r0','r1','r2','r3',
>> 'r4','r5','r6','r7',
>> 'r8','r9','r10','r11',
>> 'r12','r13','r14','r15'
>> // etc till 'r31'
>> ];
>>
>> let temp = 1*a + 2*b + 4*c + 8*d + 16*e;
>>
>> // the result can also be evilly eval()-ed:
>> alert('Result: ' + k[temp] );
>>
>> </script>
>
> I think you misunderstand the purpose of a K-Map. It's for
> simplification of compound Boolean expressions.
You might certainly think so,
but this is not about the PURPOSE of a K-Map,
which is not quite part of its definition.
This is about the solution of ...
> The potential
> application for the OP would be to reduce the number of if-else
> statements.
indeed, which my example posed.
> IIUC, you're thinking of this in terms of a degenerate
> Incidence matrix [1]
You might certainly think so,
but I think I am in a less degenerate position to
grasp what I think.
> [1] <https://en.wikipedia.org/wiki/Incidence_matrix>
I reduced the number of if-else statements to ZERO.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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