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


Groups > comp.lang.javascript > #30755

Re: Impact of implicit arrays...

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From "Chris M. Thomasson" <invalid@invalid.invalid>
Newsgroups comp.lang.javascript
Subject Re: Impact of implicit arrays...
Date Sat, 25 Jun 2016 18:03:05 -0700
Organization n/a
Lines 70
Message-ID <nkn9kd$kfc$1@dont-email.me> (permalink)
References <njhj52$hl3$1@gioia.aioe.org> <4a1c28ea-447b-4e9b-9c75-68ef85c379e7@googlegroups.com> <njq6qn$qc3$1@gioia.aioe.org> <a1db3c29-049f-44a0-ae2d-e6c38776ddd7@googlegroups.com> <nkccds$mm6$1@dont-email.me> <99986aa5-dd0c-45a1-a294-90d9c5cada54@googlegroups.com> <nkd300$iml$1@dont-email.me> <994a5f96-b90f-4078-8626-543bf6a2e9e6@googlegroups.com> <nkhkt6$dfv$1@dont-email.me> <bc601b80-611c-4775-9343-f425f0de0326@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Sun, 26 Jun 2016 01:03:09 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="98084a227c6f2f039ecddd7950c40a31"; logging-data="20972"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/pu4EvMMPaib/vsNLhYHdMzpGZ3L/OGl8="
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1
In-Reply-To <bc601b80-611c-4775-9343-f425f0de0326@googlegroups.com>
Cancel-Lock sha1:ErwdXAhBLQARr9mu+lE0iBfsIgo=
Xref csiph.com comp.lang.javascript:30755

Show key headers only | View raw


On 6/24/2016 7:16 AM, Michael Haufe (TNO) wrote:
> On Thursday, June 23, 2016 at 4:38:51 PM UTC-5, Chris M. Thomasson wrote:
>> On 6/21/2016 11:09 PM, Michael Haufe (TNO) wrote:
>>> On Tuesday, June 21, 2016 at 11:08:39 PM UTC-5, Chris M. Thomasson wrote:
>> [...]
>>> even in your example the roots array still only has two components per entry
>>
>> Yup. Humm, how about the following functional addition function:
>>
>> (please excuse any typos, I typed this in the newsreader)
>> _______________________________________
>> function ct_complex_add(a, b) {
>>      var n = Math.min(a.length, b.length);
>>
>>      var sum = new Array(n);
>>
>>      for (var i = 0; i < n; ++i) {
>>          sum[i] = a[i] + b[i];
>>      }
>>
>>      return sum;
>> }
>> _______________________________________
>>
>>
>> You can call it like:
>> _______________________________________
>> {
>>      var r = ct_complex_add([1, 2], [3, 4]);
>>      alert("r:(" + r + ")");
>>      return true;
>> }
>> _______________________________________
>>
>>
>> We can add extra elements to the arrays, and the function
>> (ct_complex_add) still works:
>>
>> _______________________________________
>> {
>>
>>      var r = ct_complex_add([1, 2, 3, 4], [5, 6, 7, 8]);
>>      alert("r:(" + r + ")");
>>      return true;
>> }
>> _______________________________________
>>
>>
>>
>>
>> We can add extra elements or even pass arrays that have different number
>> of elements:
>> _______________________________________
>> {
>>
>>      var r = ct_complex_add([1, 2, 3], [4, 5, 6, 7]);
>>      alert("r:(" + r + ")");
>>      return true;
>> }
>> _______________________________________
>>
>>
>>
>> What do you think of this? Is it a bit too contrived?
>
> What do the arrays represent in this case? Before it was [Re,Im]
>

x, y, z, w? I admit this is highly contrived wrt justifying arrays via 
looping... ;^o

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


Thread

Impact of implicit arrays... "Chris M. Thomasson" <nospam@nospam.com> - 2016-06-11 10:52 -0700
  Re: Impact of implicit arrays... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-12 12:16 +0200
    Re: Impact of implicit arrays... "Chris M. Thomasson" <nospam@nospam.com> - 2016-06-13 12:23 -0700
  Re: Impact of implicit arrays... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-13 22:00 -0700
    Re: Impact of implicit arrays... "Chris M. Thomasson" <nospam@nospam.com> - 2016-06-14 17:17 -0700
      Re: Impact of implicit arrays... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-15 06:55 +0200
      Re: Impact of implicit arrays... "Chris M. Thomasson" <nospam@nospam.invalid> - 2016-06-14 22:19 -0700
      Re: Impact of implicit arrays... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-18 12:47 -0700
        Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-21 14:43 -0700
          Re: Impact of implicit arrays... "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-22 00:10 +0200
            Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-21 15:28 -0700
              Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-21 15:31 -0700
                Re: Impact of implicit arrays... "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-22 11:55 +0200
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-23 12:23 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-23 14:14 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-23 14:16 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-23 18:14 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-23 18:46 -0700
          Re: Impact of implicit arrays... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-21 17:35 -0700
            Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-21 21:08 -0700
              Re: Impact of implicit arrays... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-21 23:09 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-23 14:38 -0700
                Re: Impact of implicit arrays... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-24 07:16 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-25 18:03 -0700
                Re: Impact of implicit arrays... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 18:24 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-07-01 13:52 -0700

csiph-web