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


Groups > comp.lang.javascript > #37692

Re: Lazy programmers guide to blizz

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Arno Welzel <usenet@arnowelzel.de>
Newsgroups comp.lang.javascript
Subject Re: Lazy programmers guide to blizz
Date Tue, 5 Nov 2019 11:06:31 +0100
Lines 90
Message-ID <h2cvt8Fs247U1@mid.individual.net> (permalink)
References <a5e610b3-f5ee-4d80-a085-0d9300fa5e1d@googlegroups.com> <h22e8qFlomcU1@mid.individual.net> <b46ff393-40e8-440f-bbb6-c46803f03859@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace individual.net +MI3bpglNwD7AndGtT8KLACPAShW08fCPyhw8ABXpKfBCKqJ6H
Cancel-Lock sha1:vnKrWsmNfY71jZBhS5Oz32lfmGM=
In-Reply-To <b46ff393-40e8-440f-bbb6-c46803f03859@googlegroups.com>
Content-Language en-US
Xref csiph.com comp.lang.javascript:37692

Show key headers only | View raw


On 01.11.19 14:27, Jonas Thörnvall wrote:

> Den fredag 1 november 2019 kl. 11:04:17 UTC+1 skrev Arno Welzel:
>> On 01.11.19 08:50, Jonas Thörnvall wrote:
>>> It so boring writing if intervals using < > or > <
>>> And hard to read
>>> Why not simplify 
>>>
>>> if(A inside.interval(144-159))
>>> if (A outside.interval(144-159))
>>>
>>> Maybe there already is interval functions in javascript?
>>>
>>> Alteratively for the operator fixated
>>> if   (144< A <159)
>>> if   (144> A >159)
>>
>> Hmmm...
>>
>>
>>     A inside.interval(144-159)
>>
>> vs.
>>
>>     A >= 144 && A <= 160
>>
>> And you find the first one really simpler? I don't.
>>
>> For example: does inside.interval() mean ">=" and "<=" or ">" and "<"?
>> This is not clear when looking at the code.
>>
>> But if you prefer this, just create your own function - assuming, that
>> the interval means including the lower and upper limit:
>>
>> function between(x, min, max) {
>>   return x >= min && x <= max;
>> }
>>
>>
>>
>>
>> -- 
>> Arno Welzel
>> https://arnowelzel.de

JFTR: This is a signature which is usally not cited. The delimiter can
be recognized by the trailing space: "-- ". Real usenet clients will
automatically handle this. You should consider using a NNTP server and a
usenet client instead of Google Groups.

> Well i would definitly interpretate that the boundaries are inside, because they can't be outside.

Including the boundaries does not mean "outside".

For example:

x>=10 && x<=20

x can be 10 or 20 and is still inside the range

x>10 && x<20

x must be more than 10 and less then 20 to be inside the range.


And furthermore:

x inside(a-b)

All programming languages I know (shell scripts, C, C++, C#, PHP,
ECMAScript, Java etc.) see "a-b" as "a minus b". And interpreting "-" as
"," depending on the context is just stupid since this would require a
additional code in some cases, for example if a or b are not absolute
values or variables but expressions:

x inside((a-1)-b)

And reading this is even worse: the first "-" is "minus" and the second
"-" would be the "range" operator.

Before you think about how to add new syntax to a language you should
first learn the basics. YACC/LEX may be a good starting point:

http://dinosaur.compilertools.net



-- 
Arno Welzel
https://arnowelzel.de

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


Thread

Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-01 00:50 -0700
  Re: Lazy programmers guide to blizz dr.j.r.stockton@gmail.com - 2019-11-01 02:42 -0700
    Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-01 06:22 -0700
      Re: Lazy programmers guide to blizz Silvio <silvio@internet.com> - 2019-11-01 18:21 +0100
        Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-01 10:39 -0700
          Re: Lazy programmers guide to blizz Silvio <silvio@internet.com> - 2019-11-02 19:45 +0100
            Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-02 17:57 -0700
        Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-01 10:42 -0700
  Re: Lazy programmers guide to blizz John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-01 09:58 +0000
    Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-01 12:22 -0700
      Re: Lazy programmers guide to blizz dr.j.r.stockton@gmail.com - 2019-11-01 14:02 -0700
        Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-01 15:19 -0700
  Re: Lazy programmers guide to blizz Arno Welzel <usenet@arnowelzel.de> - 2019-11-01 11:04 +0100
    Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-01 06:27 -0700
      Re: Lazy programmers guide to blizz Arno Welzel <usenet@arnowelzel.de> - 2019-11-05 11:06 +0100
  Re: Lazy programmers guide to blizz luserdroog <luser.droog@gmail.com> - 2019-11-01 10:44 -0700
    Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-01 13:19 -0700
      Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-01 13:23 -0700
        Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-02 03:57 -0700
          Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-02 04:02 -0700
          Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-02 04:44 -0700
          Re: Lazy programmers guide to blizz Arno Welzel <usenet@arnowelzel.de> - 2019-11-05 11:20 +0100
        Re: Lazy programmers guide to blizz Arno Welzel <usenet@arnowelzel.de> - 2019-11-05 11:14 +0100
      Re: Lazy programmers guide to blizz luserdroog <luser.droog@gmail.com> - 2019-11-01 14:48 -0700
      Re: Lazy programmers guide to blizz John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-02 14:23 +0000
        Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-02 08:17 -0700
          Re: Lazy programmers guide to blizz John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-02 18:12 +0000
            Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-02 17:56 -0700
      Re: Lazy programmers guide to blizz Arno Welzel <usenet@arnowelzel.de> - 2019-11-05 11:14 +0100
        Re: Lazy programmers guide to blizz luserdroog <luser.droog@gmail.com> - 2019-11-05 09:04 -0800
  Re: Lazy programmers guide to blizz Flng Fck <nothanks@invalid.invalid> - 2019-11-04 11:31 +0100
    Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-04 02:46 -0800
      Re: Lazy programmers guide to blizz Gregor Kofler <usenet@gregorkofler.com> - 2019-11-07 14:59 +0100
    Re: Lazy programmers guide to blizz Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-04 02:48 -0800
      Re: Lazy programmers guide to blizz Silvio <silvio@internet.com> - 2019-11-05 09:38 +0100

csiph-web