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


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

Reverse elements in array, they can be integers or strings.

Started byjonas.thornvall@gmail.com
First post2015-05-16 02:03 -0700
Last post2015-05-17 11:27 +0100
Articles 10 on this page of 50 — 5 participants

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


Contents

  Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 02:03 -0700
    Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 02:10 -0700
      MAX_SAFE_INTEGER & MIN_SAFE_INTEGER, was Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 12:03 +0200
    Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 11:37 +0200
      Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 02:58 -0700
        Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 12:22 +0200
          Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 03:44 -0700
            Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 14:52 +0200
              Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 06:09 -0700
                Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 15:30 +0200
        Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 03:37 -0700
          Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 15:00 +0200
            Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 06:24 -0700
              Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 15:54 +0200
                Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 07:01 -0700
                  Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 21:05 +0200
            Re: Reverse elements in array, they can be integers or strings. Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-16 23:07 +0000
              Re: Reverse elements in array, they can be integers or strings. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-17 00:28 +0100
                Re: Reverse elements in array, they can be integers or strings. Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-17 10:37 +0000
                Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-17 13:34 +0200
        Re: Reverse elements in array, they can be integers or strings. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-16 12:01 +0100
          Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 04:14 -0700
            Re: Reverse elements in array, they can be integers or strings. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-16 13:11 +0100
              Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 06:37 -0700
                Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 06:54 -0700
                  Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 15:58 +0200
                    Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 07:04 -0700
                      Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 21:16 +0200
                    Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 07:51 -0700
                      Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 21:25 +0200
                Re: Reverse elements in array, they can be integers or strings. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-16 21:41 +0100
                  Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 16:51 -0700
                    Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-17 11:14 +0200
                      Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-17 03:04 -0700
                        Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-17 12:40 +0200
                          Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-17 06:04 -0700
                            Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-17 21:47 +0200
                              Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-17 15:06 -0700
                                Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-18 00:57 +0200
                                  Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-17 17:10 -0700
                                    Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-18 13:16 +0200
                            Re: Reverse elements in array, they can be integers or strings. John Harris <niam@jghnorth.org.uk.invalid> - 2015-05-18 10:28 +0100
                              Re: Reverse elements in array, they can be integers or strings. Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-18 16:44 +0000
                                Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-18 10:16 -0700
                              Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-18 10:13 -0700
                                Re: Reverse elements in array, they can be integers or strings. John Harris <niam@jghnorth.org.uk.invalid> - 2015-05-18 19:42 +0100
                    Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-17 02:58 -0700
              Re: Reverse elements in array, they can be integers or strings. Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-16 22:41 +0000
            Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 15:11 +0200
        Re: Reverse elements in array, they can be integers or strings. John Harris <niam@jghnorth.org.uk.invalid> - 2015-05-17 11:27 +0100

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


#27729

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-05-18 13:16 +0200
Message-ID<XnsA49E87156D7FEeejj99@194.109.133.246>
In reply to#27725
jonas.thornvall@gmail.com wrote on 18 mei 2015 in comp.lang.javascript:

>> No, CERTAINLY NOT!
> 
> Good it all was copied from Wikipedia so now you can go on argue with
> them. http://en.wikipedia.org/wiki/Numerical_digit

So even here you are not giving any argument,
and think TENS and TENTHS are the same?

> I am really not interested in a merry go round about nothing than you
> making a fool of yourself. 

I remember you started this thread, so you should be interested.

For the rest this sentence is so bad English 
that the comparison has no meaning.

> But i will do arithnetic on very big numbers
> using very big bases. Well i can do it on very small to. 

Mamma look, no hands! How good of you.

Were you looking for help when you opend this thread?
Anyway, you do not decide what responses you want or not.

> But i am not even sure partitioning 

"partitioning"? 
What do you mean by that here?

> whole numbers 

Do you still mean "integers"?

Integers are values, you can not manipulate values, 
you can only manipulate representations of values.

> within respective base is a good idea.

It is not just a bad idea,
you simply cannot do that as integers are values,
and values have no base.

> I prefer sums of fractions. 

So you suddenly prefer the result of added fractions,
over substracted fractions perhaps?

What fractions?

What has your preference to do with the above? 

It seems you are just uttering unconnected sentences.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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


#27727

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2015-05-18 10:28 +0100
Message-ID<d5cjlaprggupr6834j786e1f7e24235nvo@4ax.com>
In reply to#27718
On Sun, 17 May 2015 06:04:19 -0700 (PDT), jonas.thornvall@gmail.com
wrote:

  <snip>
>If an array represent a set Y=[1,1,1,1,1] would equal 5... I think 
>it is possible to learn 4 years old this level of set theory.
  <snip>

If  Y=[1,1,1,1,1]  is saying that 1 is a member of the set Y then
saying it 5 times makes no difference - it's still the same set with
one member.

However, if  [1,1,1,1,1]  is a list, then that's all right - it has
five elements - but it's not representing a set.

  John

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


#27733

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2015-05-18 16:44 +0000
Message-ID<mjd4t6$f4r$3@dont-email.me>
In reply to#27727
On Mon, 18 May 2015 10:28:48 +0100, John Harris wrote:

> However, if  [1,1,1,1,1]  is a list, then that's all right - it has five
> elements - but it's not representing a set.

There is the set of things JT understands, and the universal set. We're 
still looking for the intersection, but the harder we look, the more 
apparent it becomes that the set of things JT understands is the empty 
set.

-- 
Denis McMahon, denismfmcmahon@gmail.com

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


#27735

Fromjonas.thornvall@gmail.com
Date2015-05-18 10:16 -0700
Message-ID<daf7816f-1dfa-40ee-9b75-6f8cbaa14fbe@googlegroups.com>
In reply to#27733
Den måndag 18 maj 2015 kl. 18:45:36 UTC+2 skrev Denis McMahon:
> On Mon, 18 May 2015 10:28:48 +0100, John Harris wrote:
> 
> > However, if  [1,1,1,1,1]  is a list, then that's all right - it has five
> > elements - but it's not representing a set.
> 
> There is the set of things JT understands, and the universal set. We're 
> still looking for the intersection, but the harder we look, the more 
> apparent it becomes that the set of things JT understands is the empty 
> set.
> 
> -- 
> Denis McMahon, denismfmcmahon@gmail.com

You draw a ring with five tallymarks within you have a set with five members. Ever so often the tallymarks turn out to be five idiots who do not know howto break out of the circle, of nonsense reasoning.

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


#27734

Fromjonas.thornvall@gmail.com
Date2015-05-18 10:13 -0700
Message-ID<422f2e81-45de-48ab-a44b-d9e4f2847dee@googlegroups.com>
In reply to#27727
Den måndag 18 maj 2015 kl. 11:28:54 UTC+2 skrev John Harris:
> On Sun, 17 May 2015 06:04:19 -0700 (PDT), jonas.thornvall@gmail.com
> wrote:
> 
>   <snip>
> >If an array represent a set Y=[1,1,1,1,1] would equal 5... I think 
> >it is possible to learn 4 years old this level of set theory.
>   <snip>
> 
> If  Y=[1,1,1,1,1]  is saying that 1 is a member of the set Y then
> saying it 5 times makes no difference - it's still the same set with
> one member.
> 
> However, if  [1,1,1,1,1]  is a list, then that's all right - it has
> five elements - but it's not representing a set.
> 
>   John

You draw a ring and write five tallymarks within it and you have a set of five members end of story.

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


#27738

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2015-05-18 19:42 +0100
Message-ID<9jcklad2f1qknbfuuh5hd08bse263rr8f5@4ax.com>
In reply to#27734
On Mon, 18 May 2015 10:13:19 -0700 (PDT), jonas.thornvall@gmail.com
wrote:

>Den måndag 18 maj 2015 kl. 11:28:54 UTC+2 skrev John Harris:
>> On Sun, 17 May 2015 06:04:19 -0700 (PDT), jonas.thornvall@gmail.com
>> wrote:
>> 
>>   <snip>
>> >If an array represent a set Y=[1,1,1,1,1] would equal 5... I think 
>> >it is possible to learn 4 years old this level of set theory.
>>   <snip>
>> 
>> If  Y=[1,1,1,1,1]  is saying that 1 is a member of the set Y then
>> saying it 5 times makes no difference - it's still the same set with
>> one member.
>> 
>> However, if  [1,1,1,1,1]  is a list, then that's all right - it has
>> five elements - but it's not representing a set.
>> 
>>   John
>
>You draw a ring and write five tallymarks within it and you have a set of five members end of story.

If the tallymarks represent different things then, yes, you have five
members.

On the other hand, if two of the tally marks represent the *same*
thing, then you don't have five members.

That's how sets work and is what I said.

  John

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


#27711

Fromjonas.thornvall@gmail.com
Date2015-05-17 02:58 -0700
Message-ID<f8e4c2bc-d97f-4eff-8620-81690e8a4868@googlegroups.com>
In reply to#27704
Den söndag 17 maj 2015 kl. 01:51:57 UTC+2 skrev jonas.t...@gmail.com:
> Den lördag 16 maj 2015 kl. 22:41:27 UTC+2 skrev Ben Bacarisse:
> > jonas.thornvall@gmail.com writes:
> > 
> > > Den lördag 16 maj 2015 kl. 14:11:27 UTC+2 skrev Ben Bacarisse:
> > >> jonas.thornvall@gmail.com writes:
> > <snip>
> > >> > Really how hard can it be to understand.
> > >> 
> > >> And how hard is it to do what I ask?  Show the console.log output for
> > >> the array you have and then do the same for the string you want to
> > >> print.
> > <snip sig -- you should do that yourself>
> > 
> > > I did get your point about using console.log() Ben and i appreciate
> > > it.
> > 
> > So why have you not done it?  Obviously it makes no difference to me if
> > you never get an answer to your question about "reversing elements of an
> > array" but you seem prepared to debate your meaning endlessly rather than
> > simply providing concrete data about what you want.
> > 
> > <snip>
> > -- 
> > Ben.
> 
> I did use it and found a bug, there was string values in the integer array due to my faulthy use of join upon the integers.
> 
> So you did help, thank you.

http://jt.node365.se/baseconversion.html

Thanks to Ben and console.log(), the format output bug is fixed it was rather silly i somehow used join and converted integers to strings.

However it still do stall as the base goes up and it get worse as the base get more digits.

I do not think it simply about the counter having more work todo that would be neglectable for bases below 1000. 

But since the bug seem hard to track down i go on replace the search algorithm to replace the counter. 

And hopefully the lagging will dissapear.
I find it quite strange how the behaviour change as one goes from base 10 to 11. One could think it could multiply the time by some factor, but not make it 10 000 times slower.

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


#27701

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2015-05-16 22:41 +0000
Message-ID<mj8h28$f1c$3@dont-email.me>
In reply to#27673
On Sat, 16 May 2015 13:11:19 +0100, Ben Bacarisse wrote:

> At some point you will start to take people's advice.  Until then I
> don't think you will make much headway.

The question is whether he'll start listening to advice before people 
offering advice tire of having it ignored.

-- 
Denis McMahon, denismfmcmahon@gmail.com

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


#27677

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-05-16 15:11 +0200
Message-ID<XnsA49C9A8FBF92Aeejj99@194.109.133.246>
In reply to#27672
jonas.thornvall@gmail.com wrote on 16 mei 2015 in comp.lang.javascript:

> No thar is not the question, i want to reverse the array 

DO NOT REVERSE ARRAYS, manipulate the index.

> and reverse the digits of *each element* 

members of elements have no digits, but values.

> within array on *decimal level*.

Nonsensical words, what is *decimal level*, please make some sense in that.

> I am doing arithmetic upon the elements so i know they are not stored as
> characters and strings. 

Elements are not stored as anything,
elements can only have a variable value of one of the types.

So you "store a value in an element".

> So i *assume* that the element stored at each index within array is an
> integer. 

No, the value stored in an array element can be one of the named types,
and if it is a floating point numeric value, that value can be an integer.
 
> Really how hard can it be to understand.

Really hard, Jonas, because you use terminology that you make up yourself,
and that is inconsistent with the workings of Javascript, logic and 
mathemetics. 

That means we have to guess what you mean and then try to correct you.

Finally:
DO NOT REVERSE ARRAYS, manipulate the index.

And please, don't say that in an array of arrays, 
the inner arrays are not arrays.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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


#27713

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2015-05-17 11:27 +0100
Message-ID<h7rglatogjg7ng2sgi553st5qaoqe50pnc@4ax.com>
In reply to#27665
On Sat, 16 May 2015 02:58:10 -0700 (PDT), jonas.thornvall@gmail.com
wrote:


  <snip>
>An example Janevert
>
>21 should encode to [1,10] in base eleven because 11+10.
>But is stored in array as [01,1]
>
>Now i want a printout 1,10
  <snip>

The obvious thing to do is to write two functions for accessing arrays
and strings in reverse :
  reverseAccessArray
  reverseAccessString
To get the item at index 3 from the end of the array a you call
  reverseAccessArray(a, 3)
To get the item at index 4 from the end of the string b you call
  reverseAccessString(b, 4)

And to get the item at index 4 from the end of the string that is at
index 3 from the end of the array a you call
  reverseAccessString(reverseAccessArray(a, 3),  4)
Could anything be simpler?

  John

[toc] | [prev] | [standalone]


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

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


csiph-web