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


Groups > comp.lang.javascript > #37709 > unrolled thread

Comparisson with a list arguments.

Started byJonas Thörnvall <jonas.thornvall@gmail.com>
First post2019-11-08 00:07 -0800
Last post2019-11-14 08:11 +0100
Articles 10 on this page of 30 — 5 participants

Back to article view | Back to comp.lang.javascript


Contents

  Comparisson with a list arguments. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-08 00:07 -0800
    Re: Comparisson with a list arguments. Julio Di Egidio <julio@diegidio.name> - 2019-11-08 00:17 -0800
      Re: Comparisson with a list arguments. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-08 01:03 -0800
        Re: Comparisson with a list arguments. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-08 01:08 -0800
          Re: Comparisson with a list arguments. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-08 01:19 -0800
          Re: Comparisson with a list arguments. Arno Welzel <usenet@arnowelzel.de> - 2019-11-12 12:17 +0100
        Re: Comparisson with a list arguments. Julio Di Egidio <julio@diegidio.name> - 2019-11-08 01:13 -0800
          Re: Comparisson with a list arguments. Julio Di Egidio <julio@diegidio.name> - 2019-11-08 01:23 -0800
            Re: Comparisson with a list arguments. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-08 01:30 -0800
              Re: Comparisson with a list arguments. Julio Di Egidio <julio@diegidio.name> - 2019-11-08 02:19 -0800
                Re: Comparisson with a list arguments. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-08 02:33 -0800
                  Re: Comparisson with a list arguments. Arno Welzel <usenet@arnowelzel.de> - 2019-11-12 15:25 +0100
                    Re: Comparisson with a list arguments. Julio Di Egidio <julio@diegidio.name> - 2019-11-12 06:48 -0800
                      Re: Comparisson with a list arguments. Arno Welzel <usenet@arnowelzel.de> - 2019-11-12 18:41 +0100
                        Re: Comparisson with a list arguments. Julio Di Egidio <julio@diegidio.name> - 2019-11-12 09:50 -0800
                          Re: Comparisson with a list arguments. Arno Welzel <usenet@arnowelzel.de> - 2019-11-12 18:55 +0100
              Re: Comparisson with a list arguments. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-08 11:33 +0000
                Re: Comparisson with a list arguments. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-08 06:53 -0800
                  Re: Comparisson with a list arguments. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-08 19:31 +0000
                    Re: Comparisson with a list arguments. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-08 11:38 -0800
                      Re: Comparisson with a list arguments. Arno Welzel <usenet@arnowelzel.de> - 2019-11-12 15:26 +0100
              Re: Comparisson with a list arguments. Arno Welzel <usenet@arnowelzel.de> - 2019-11-12 15:23 +0100
          Re: Comparisson with a list arguments. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-11 01:31 -0800
        Re: Comparisson with a list arguments. Arno Welzel <usenet@arnowelzel.de> - 2019-11-12 12:16 +0100
    Re: Comparisson with a list arguments. luserdroog <luser.droog@gmail.com> - 2019-11-08 08:35 -0800
    Re: Comparisson with a list arguments. Arno Welzel <usenet@arnowelzel.de> - 2019-11-12 12:13 +0100
      Re: Comparisson with a list arguments. Julio Di Egidio <julio@diegidio.name> - 2019-11-12 06:39 -0800
        Re: Comparisson with a list arguments. Arno Welzel <usenet@arnowelzel.de> - 2019-11-12 18:52 +0100
          Re: Comparisson with a list arguments. Julio Di Egidio <julio@diegidio.name> - 2019-11-12 10:08 -0800
            Re: Comparisson with a list arguments. Arno Welzel <usenet@arnowelzel.de> - 2019-11-14 08:11 +0100

Page 2 of 2 — ← Prev page 1 [2]


#37761

FromArno Welzel <usenet@arnowelzel.de>
Date2019-11-12 15:26 +0100
Message-ID<h2vtooFr2hfU3@mid.individual.net>
In reply to#37727
On 08.11.19 20:38, Jonas Thörnvall wrote:

> Den fredag 8 november 2019 kl. 20:31:37 UTC+1 skrev John G Harris:
[...]
>> Well yes, so why are you complaining about the syntax that was chosen.
>>
>>   John
> 
> It does not make sense.

Then don't use it. You are free to create a parser for your own language.


-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#37759

FromArno Welzel <usenet@arnowelzel.de>
Date2019-11-12 15:23 +0100
Message-ID<h2vtjcFr2hfU1@mid.individual.net>
In reply to#37716
On 08.11.19 10:30, Jonas Thörnvall wrote:

[...]
> But is not the idea to make things as easy as possible, not as
> obfuscated and convoluted as possible? I mean it is a scripting

Look at this:

a = floor(b-z);
if (a inside(x-y)) {
  dosomething();
}

This *is* "obfuscated and convulated as possible".

1) Why is "x-y" not the *expression* of "x minus y" as it was a line
before where "b-z" means "b minus z"? This is completely illogical.

2) Does "inside (x-y)" mean "more than x and less than y" (>x && <y) or
"the same or more than x and the same or less than y" (>=x && <=y)?

There is no universal definition which says, that a number is only
inside an interval if it is more than the lower limit and less then the
upper limit.

But an expression like "a>x && b<y" is clear - a has to be more than x
and less then y where "a>=x && b<=y" includes the lower and upper limit.

3) What if x or y are not scalar values but expressions?

Let's say x is calculated as "p-t":

if (a inside(p-t-y)) {
  dosomething();
}

Well - of course this makes no sense. So you need to define a rule, that
expressions are either not allowed here or the have to be in paranthesis:

if (a inside((p-t)-y)) {
  dosomething();
}

But again: why is "p-t" an expresion "p minus t" and "(p-t)-y" means
"from p minus t to y"? This is also quite confusing.

If you go on like this, you may end up with a kind of natural language
parser and not a programming language.

And what exactly is your problem with "if (a>x && a<y)" ? The meaning is
completely clear.

> language we are not into blip-blopping we try to raise the context so
> the syntax can mirror a somewhat working semantic. Or are we
> protecting our jobs, i just want to know what is going on and why?
> 
> This is a script language, made to be available as a learning
> language, where principles are elevated to reflect human thinking? So
> ideas that can be presented clear in language should also be possible
> to implement, or are we trying to create a lingo to cringe books and
> seminars?

JavaScript is *not* intended as "learning language". It is just a
scripting language, nothing else.

Either you take it it as it is or you create your own language where you
can implement all the things you want to have. Maybe this would be a
good exercise for you so you realize what it means to interpret source
code in a way that the computer knows what to do.

At least you should not suggest "-" for the interval parameter, so it
would be:

if (a inside(x,y))

But then you can also just create your own class for "a" which provides
an method inside():

if (a.inside(x,y))



-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#37747

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-11-11 01:31 -0800
Message-ID<a6cd1253-d467-4eff-8c47-478d7d92e8d4@googlegroups.com>
In reply to#37713
Den fredag 8 november 2019 kl. 10:13:59 UTC+1 skrev Julio Di Egidio:
> On Friday, 8 November 2019 10:03:15 UTC+1, Jonas Thörnvall  wrote:
> > Den fredag 8 november 2019 kl. 09:17:11 UTC+1 skrev Julio Di Egidio:
> > > On Friday, 8 November 2019 09:07:53 UTC+1, Jonas Thörnvall  wrote:
> > > 
> > > > if (track[editTrack].midiMess[i].data0 == ("224" || "112" || "128"))
> > > > 
> > > > One can wonder why the most obvious solustions never implemented?
> > > > I think it is weird, i just don't get it....
> > > 
> > > Shouldn't it rather be obvious (to you!) that you don't know what you are
> > > talking about?
> > > 
> > > In fact, if you want a "compact" solution, there even is a legitimate one:
> > > 
> > >    ["224", "112", "128"].includes(myValue)
> > > 
> > > <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes>
> > 
> > It is totally fucking backward semantics "lingo" but i accept it as some
> > sort of answer.
> 
> LOL.
> 
> > OK so how do you compare with two or more intervals in javascript?
> > if(A outside.interval(144-159)) && (A outside.interval(222-300))
> > 
> > Can you give me the lingo for that one....
> 
> That's a different question, now it's not a list but (virtually continuous)
> *intervals*, so you use the maths: (A < min1 && A > max1) && repeat...
> 
> And not to just keep duplicating code, you use a function!!!
> 
> Or, similarly, not to write huge.ungodly[fucking].mess.base0 all over the
> place, you a local variable: then you'll already get very much less annoyed
> by just a sequence of few logical conjunctions...
> 
> Julio

Well you are quite correct it was indeed a good idea to have a local name for the indexed object, just careful to do it inside loop. Much easier to read now.

[toc] | [prev] | [next] | [standalone]


#37757

FromArno Welzel <usenet@arnowelzel.de>
Date2019-11-12 12:16 +0100
Message-ID<h2vijoFondnU2@mid.individual.net>
In reply to#37711
On 08.11.19 10:03, Jonas Thörnvall wrote:

> Den fredag 8 november 2019 kl. 09:17:11 UTC+1 skrev Julio Di Egidio:
[...]
>> <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes>
>>
>> HTH,
>>
>> Julio
> 
> It is totally fucking backward semantics "lingo" but i accept it as some sort of answer.
> 
> OK so how do you compare with two or more intervals in javascript?
> if(A outside.interval(144-159)) && (A outside.interval(222-300))
> 
> Can you give me the lingo for that one....

Do yourself and us a favour and create your own language which works
exactly how you want it. Then you don't have to complain all the time
how stupid ECMAScript ist.



-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#37723

Fromluserdroog <luser.droog@gmail.com>
Date2019-11-08 08:35 -0800
Message-ID<162a1e7d-814a-43d3-9c54-bfa90cf26fb7@googlegroups.com>
In reply to#37709
On Friday, November 8, 2019 at 2:07:53 AM UTC-6, Jonas Thörnvall wrote:
> It would be handy to be able to have a list of arguments to compare with, of course one could store the values in an array use a loop to scroll thru.
> 
> But something like this would be easier to use.
> 
> if (track[editTrack].midiMess[i].data0 == ("224" || "112" || "128"))
> 
> 
> One can wonder why the most obvious solustions never implemented?
> I think it is weird, i just don't get it....
> 
> And then you end up with a string that is hardly readable, or the need to read in the values into an array. It is just weird, do you guys never favour readability of code?

https://en.wikipedia.org/wiki/Chomsky_hierarchy
https://en.wikipedia.org/wiki/Context-free_grammar
https://en.wikipedia.org/wiki/Context-sensitive_grammar

[toc] | [prev] | [next] | [standalone]


#37756

FromArno Welzel <usenet@arnowelzel.de>
Date2019-11-12 12:13 +0100
Message-ID<h2vieaFondnU1@mid.individual.net>
In reply to#37709
On 08.11.19 09:07, Jonas Thörnvall wrote:
> It would be handy to be able to have a list of arguments to compare
> with, of course one could store the values in an array use a loop to
> scroll thru.
> 
> But something like this would be easier to use.
> 
> if (track[editTrack].midiMess[i].data0 == ("224" || "112" || "128"))
> 
> 
> One can wonder why the most obvious solustions never implemented? I
> think it is weird, i just don't get it....

It is:

<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes>

> And then you end up with a string that is hardly readable, or the
> need to read in the values into an array. It is just weird, do you
> guys never favour readability of code?

Who is "you guys"? You have to ask the people maintaining ECMAScript.


-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#37763

FromJulio Di Egidio <julio@diegidio.name>
Date2019-11-12 06:39 -0800
Message-ID<4b56930e-a980-40d5-8a87-2e92597fab03@googlegroups.com>
In reply to#37756
On Tuesday, 12 November 2019 12:13:22 UTC+1, Arno Welzel  wrote:
> On 08.11.19 09:07, Jonas Thörnvall wrote:

> > One can wonder why the most obvious solustions never implemented? I
> > think it is weird, i just don't get it....
> 
> It is:
> 
> <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes>

Why are you being a total jerk again, posting over everything and undoing
anything I had done??  And then you ask why I call you names??

Julio

[toc] | [prev] | [next] | [standalone]


#37769

FromArno Welzel <usenet@arnowelzel.de>
Date2019-11-12 18:52 +0100
Message-ID<h309q5Ftj47U1@mid.individual.net>
In reply to#37763
On 12.11.19 15:39, Julio Di Egidio wrote:

> On Tuesday, 12 November 2019 12:13:22 UTC+1, Arno Welzel  wrote:
>> On 08.11.19 09:07, Jonas Thörnvall wrote:
> 
>>> One can wonder why the most obvious solustions never implemented? I
>>> think it is weird, i just don't get it....
>>
>> It is:
>>
>> <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes>
> 
> Why are you being a total jerk again, posting over everything and undoing
> anything I had done??  And then you ask why I call you names??

What are you talking about? Your posts are still there for everybody to
read. That's no reason to call me a "jerk".

It's even better for you: everbody can see, that you already mentioned
the URL at Mozilla a couple of days ago and that I seem have not to read
every other answer before I answer the original question.

So what? Are you an autist? Then I'm sorry to confuse you.




-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#37771

FromJulio Di Egidio <julio@diegidio.name>
Date2019-11-12 10:08 -0800
Message-ID<3c4f1cf7-37f3-420c-8126-f9a8231c10a7@googlegroups.com>
In reply to#37769
On Tuesday, 12 November 2019 18:52:11 UTC+1, Arno Welzel  wrote:
> On 12.11.19 15:39, Julio Di Egidio wrote:
> > On Tuesday, 12 November 2019 12:13:22 UTC+1, Arno Welzel  wrote:
> >> On 08.11.19 09:07, Jonas Thörnvall wrote:
> > 
> >>> One can wonder why the most obvious solustions never implemented? I
> >>> think it is weird, i just don't get it....
> >>
> >> It is:
> >>
> >> <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes>
> > 
> > Why are you being a total jerk again, posting over everything and undoing
> > anything I had done??  And then you ask why I call you names??
> 
> What are you talking about? Your posts are still there for everybody to
> read. That's no reason to call me a "jerk".
> 
> It's even better for you: everbody can see, that you already mentioned
> the URL at Mozilla a couple of days ago and that I seem have not to read
> every other answer before I answer the original question.

Yes, on Usenet you definitely should: it's called collaboration, indeed the
opposite of what you are doing, you cheap, hypocritical, abusive, liar.

> So what? Are you an autist? Then I'm sorry to confuse you.

So what??  And I am the autist?  Sure, keep going...

*Plonk*

Julio

[toc] | [prev] | [next] | [standalone]


#37903

FromArno Welzel <usenet@arnowelzel.de>
Date2019-11-14 08:11 +0100
Message-ID<h34d0tFp950U1@mid.individual.net>
In reply to#37771
Julio Di Egidio:

> *Plonk*
> 
> Julio

Let me guess... you will again continue to read my posts even after this
"plonk" and complain about your time getting wasted.

To help you a bit:

<http://catb.org/~esr/jargon/html/P/plonk.html>

But alas - Google Groups doesn't have a killfile...


-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.javascript


csiph-web