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


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

Multidimensional arrays in javascript

Started byjonas.thornvall@gmail.com
First post2015-12-02 14:31 -0800
Last post2015-12-03 07:15 -0800
Articles 17 on this page of 37 — 12 participants

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


Contents

  Multidimensional arrays in javascript jonas.thornvall@gmail.com - 2015-12-02 14:31 -0800
    Re: Multidimensional arrays in javascript jonas.thornvall@gmail.com - 2015-12-02 14:47 -0800
    Re: Multidimensional arrays in javascript "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-12-02 14:50 -0800
    Re: Multidimensional arrays in javascript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-12-03 00:42 +0100
      Re: Multidimensional arrays in javascript jonas.thornvall@gmail.com - 2015-12-02 18:03 -0800
      Re: Multidimensional arrays in javascript jonas.thornvall@gmail.com - 2015-12-03 09:04 -0800
        Re: Multidimensional arrays in javascript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-12-03 18:23 +0100
          Re: Multidimensional arrays in javascript jonas.thornvall@gmail.com - 2015-12-03 09:48 -0800
            Re: Multidimensional arrays in javascript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-12-03 19:49 +0100
              Re: Multidimensional arrays in javascript jonas.thornvall@gmail.com - 2015-12-03 11:17 -0800
                Re: Multidimensional arrays in javascript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-12-03 20:26 +0100
                  Re: Multidimensional arrays in javascript jonas.thornvall@gmail.com - 2015-12-03 11:32 -0800
                    Re: Multidimensional arrays in javascript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-12-03 20:37 +0100
                Re: Multidimensional arrays in javascript John Harris <niam@jghnorth.org.uk.invalid> - 2015-12-04 10:38 +0000
                  Re: Multidimensional arrays in javascript Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-04 13:37 +0100
                    Re: Multidimensional arrays in javascript John Harris <niam@jghnorth.org.uk.invalid> - 2015-12-04 16:14 +0000
                      Re: Multidimensional arrays in javascript Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-04 18:10 +0100
                        Re: Multidimensional arrays in javascript Tim Streater <timstreater@greenbee.net> - 2015-12-04 18:52 +0000
                          Re: Multidimensional arrays in javascript Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-04 20:07 +0100
                        Re: Multidimensional arrays in javascript John Harris <niam@jghnorth.org.uk.invalid> - 2015-12-06 14:47 +0000
                        Re: Multidimensional arrays in javascript John Harris <niam@jghnorth.org.uk.invalid> - 2015-12-06 16:11 +0000
                          Re: Multidimensional arrays in javascript Andrew Poulos <ap_prog@hotmail.com> - 2015-12-07 06:54 +1100
                            Re: Multidimensional arrays in javascript "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-12-06 22:43 +0100
                              Re: Multidimensional arrays in javascript Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-06 23:19 +0100
                            Re: Multidimensional arrays in javascript John Harris <niam@jghnorth.org.uk.invalid> - 2015-12-08 11:16 +0000
                  Re: Multidimensional arrays in javascript Aleksandro <aleksandro@gmx.com> - 2015-12-04 11:55 -0300
                    Re: Multidimensional arrays in javascript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-12-04 17:26 +0100
                  Re: Multidimensional arrays in javascript jonas.thornvall@gmail.com - 2015-12-04 09:23 -0800
              Re: Multidimensional arrays in javascript Stefan Weiss <krewecherl@gmail.com> - 2015-12-03 20:29 +0100
                Re: Multidimensional arrays in javascript Gene Wirchenko <genew@telus.net> - 2015-12-03 13:23 -0800
          Re: Multidimensional arrays in javascript jonas.thornvall@gmail.com - 2015-12-03 10:06 -0800
            Re: Multidimensional arrays in javascript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-12-03 20:21 +0100
          Re: Multidimensional arrays in javascript Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-03 21:00 +0100
    Re: Multidimensional arrays in javascript "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2015-12-02 16:50 -0800
      Re: Multidimensional arrays in javascript jonas.thornvall@gmail.com - 2015-12-03 07:10 -0800
        Re: Multidimensional arrays in javascript jonas.thornvall@gmail.com - 2015-12-03 07:23 -0800
      Re: Multidimensional arrays in javascript jonas.thornvall@gmail.com - 2015-12-03 07:15 -0800

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


#28981

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2015-12-06 16:11 +0000
Message-ID<3in86bl6bs3bdnsa06dhmuighmu6jb2243@4ax.com>
In reply to#28970
On Fri, 04 Dec 2015 18:10:06 +0100, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:

>John Harris wrote:
>
>> On Fri, 04 Dec 2015 13:37:35 +0100, Thomas 'PointedEars' Lahn
>> <PointedEars@web.de> wrote:
>
>Attribution *line*, _not_ attribution novel.

See [A] below.

  <snip>
>> When talking to Jonas Thornvall we need to use words that he
>> understands. I might have guessed wrong; you, Thomas, don't even try.
>
>I just do not agree with your approach.  Communicating with people as if 
>they were not intelligent keeps them ignorant and dependent.  By contrast,
>I always assume that I address intelligent people who want to learn and to 
>understand what they are doing.  

Notice the implication : Thomas assumes that people whose English is
less than perfect are not intelligent.


>So I strive to use proper terminology to 
>begin with.
  <snip>

[A]
Thomas may strive but he doesn't succeed. The term "Attribution line"
appears in Wikipedia but not in any RFC, so is not standard.


  John

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


#28982

FromAndrew Poulos <ap_prog@hotmail.com>
Date2015-12-07 06:54 +1100
Message-ID<vbqdnVTxLMLsD_nLnZ2dnUU7-c2dnZ2d@westnet.com.au>
In reply to#28981
On 7/12/2015 3:11 AM, John Harris wrote:
> On Fri, 04 Dec 2015 18:10:06 +0100, Thomas 'PointedEars' Lahn
> <PointedEars@web.de> wrote:
>
>> John Harris wrote:

>>> When talking to Jonas Thornvall we need to use words that he
>>> understands. I might have guessed wrong; you, Thomas, don't even try.
>>
>> I just do not agree with your approach.  Communicating with people as if
>> they were not intelligent keeps them ignorant and dependent.  By contrast,
>> I always assume that I address intelligent people who want to learn and to
>> understand what they are doing.
>
> Notice the implication : Thomas assumes that people whose English is
> less than perfect are not intelligent.

He's saying that he doesn't talk down to people and you're saying 
something else.

I guess one-upmanship is one of the reasons why this NG is close to dead.

Andrew Poulos

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


#28983

From"danca (Daniele Campagna)" <cyberdanny@tiscalinet.it>
Date2015-12-06 22:43 +0100
Message-ID<n42a14$d63$1@dont-email.me>
In reply to#28982
Il 12/06/2015 08:54 PM, Andrew Poulos ha scritto:
> On 7/12/2015 3:11 AM, John Harris wrote:
>> On Fri, 04 Dec 2015 18:10:06 +0100, Thomas 'PointedEars' Lahn
>> <PointedEars@web.de> wrote:
>>
>>> John Harris wrote:
>
>>>> When talking to Jonas Thornvall we need to use words that he
>>>> understands. I might have guessed wrong; you, Thomas, don't even try.
>>>
>>> I just do not agree with your approach.  Communicating with people as if
>>> they were not intelligent keeps them ignorant and dependent.  By
>>> contrast,
>>> I always assume that I address intelligent people who want to learn
>>> and to
>>> understand what they are doing.
>>
>> Notice the implication : Thomas assumes that people whose English is
>> less than perfect are not intelligent.
>
> He's saying that he doesn't talk down to people and you're saying
> something else.
>
> I guess one-upmanship is one of the reasons why this NG is close to dead.
>
> Andrew Poulos
>

This NG is not close to dead, and i'll guess there are many lurker around.
And the rivalry between Harris and Lahn must not be depreciated, in a 
sense, it is part of the show! :-)

Dan

-- 
"Everybody should pay taxes with a smile"
I tried, but they want money.

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


#28984

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2015-12-06 23:19 +0100
Message-ID<2149025.oEH7nqEUpK@PointedEars.de>
In reply to#28983
danca (Daniele Campagna) wrote:

> Il 12/06/2015 08:54 PM, Andrew Poulos ha scritto:
>> On 7/12/2015 3:11 AM, John Harris wrote:
>>> […] Thomas 'PointedEars' Lahn […] wrote:
>>>> John Harris wrote:
>>>>> When talking to Jonas Thornvall we need to use words that he
>>>>> understands. I might have guessed wrong; you, Thomas, don't even try.
>>>> I just do not agree with your approach.  Communicating with people as
>>>> if they were not intelligent keeps them ignorant and dependent.  By
>>>> contrast, I always assume that I address intelligent people who want to
>>>> learn and to understand what they are doing.
>>> Notice the implication : Thomas assumes that people whose English is
>>> less than perfect are not intelligent.
>>
>> He's saying that he doesn't talk down to people and you're saying
>> something else.

Partially.  You are correct regarding English – for how could I blame others 
for theirs when English is not my native language, too?  What I am saying is 
that I always start with the assumption that people are smart, and want to 
learn.  Wanting to learn includes to not be annoyed by unknown or seemingly 
complicated things, but to ask about the things that you do not understand; 
preferably after you have made an effort to find out by yourself.  As 
everyone’s time is valuable.

And when people behave stupid and I happen to talk down to them (instead of 
just ignoring them), it is not because I think they are stupid, but that I 
assume that they could do better if they would just put more effort into it.  
I do not suffer fools lightly indeed – that includes lazy people.

So the teaching philosophy I follow, as it has benefited me too, is probably 
closest to that of Confucius who said:

  “I do not enlighten those who are not eager to learn,
   nor arouse those who are not anxious
   to give an explanation themselves.
   If I have presented one corner of the square
   and they cannot come back to me with the other three,
   I should not go over the points again.”

>> I guess one-upmanship is one of the reasons why this NG is close to dead.
> 
> This NG is not close to dead, and i'll guess there are many lurker around.

ACK.

> And the rivalry between Harris and Lahn must not be depreciated, in a
> sense, it is part of the show! :-)

As for myself, I have no rivalry with anyone.  That is a concept completely 
foreign to me.  When I challenge someone’s ideas, it is so that all of us 
who are willing to learn can learn.

Now enough about me, let’s get back on topic.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

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


#28990

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2015-12-08 11:16 +0000
Message-ID<bued6bhlv4qfnserhu12kuk12v0i771ier@4ax.com>
In reply to#28982
On Mon, 7 Dec 2015 06:54:37 +1100, Andrew Poulos <ap_prog@hotmail.com>
wrote:

>On 7/12/2015 3:11 AM, John Harris wrote:
>> On Fri, 04 Dec 2015 18:10:06 +0100, Thomas 'PointedEars' Lahn
>> <PointedEars@web.de> wrote:
>>
>>> John Harris wrote:
>
>>>> When talking to Jonas Thornvall we need to use words that he
>>>> understands. I might have guessed wrong; you, Thomas, don't even try.
>>>
>>> I just do not agree with your approach.  Communicating with people as if
>>> they were not intelligent keeps them ignorant and dependent.  By contrast,
>>> I always assume that I address intelligent people who want to learn and to
>>> understand what they are doing.
>>
>> Notice the implication : Thomas assumes that people whose English is
>> less than perfect are not intelligent.
>
>He's saying that he doesn't talk down to people and you're saying 
>something else.

I'm saying he makes no allowance for people whose English is not
perfect. He would rather say 'You are WRONG!' than 'It is called X
really.'

Likewise he makes no allowance for people who have been taught
wrongly.


>I guess one-upmanship is one of the reasons why this NG is close to dead.

I don't like bullies and I'm willing to say so in public. That's not
one-upmanship.

  John

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


#28967

FromAleksandro <aleksandro@gmx.com>
Date2015-12-04 11:55 -0300
Message-ID<n3s9dd$ul4$1@dont-email.me>
In reply to#28965
On 04/12/15 07:38, John Harris wrote:
> On Thu, 3 Dec 2015 11:17:44 -0800 (PST), jonas.thornvall@gmail.com
> wrote:
> 
>   <snip>
>>> does it mean Javascript have typed arrays or not?
> 
> The correct answer to your question is "yes and no".
> 
> Up to and including ECMAScript version 5.1 the answer is no : there is
> no such thing as a typed array. 
> 
> In ECMAScript version 6 there are typed array objects of various
> types.
> 
> Who do you hope will view your web site? If it includes people using
> older PCs then you should assume that it's version 5.1 being used, so
> no typed arrays.

Also, one can always ask: http://caniuse.com/typed%20arrays

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


#28969

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-12-04 17:26 +0100
Message-ID<XnsA566B164BC10Feejj99@194.109.6.166>
In reply to#28967
Aleksandro <aleksandro@gmx.com> wrote on 04 Dec 2015 in 
comp.lang.javascript:

> Also, one can always ask: http://caniuse.com/typed%20arrays

"JavaScript typed arrays provide a mechanism for accessing raw binary data 
much more efficiently."

That would be/is very welcome "mechanism"!

==============================

I am going to contradict myself:

"A TypedArray object describes an array-like view of an underlying binary 
data buffer."

<https://developer.mozilla.org/nl/docs/Web/JavaScript/Reference/Global_Objec
ts/TypedArray>

"A TypedArray object describes ...."

Do objects describe something? 
Methinks the ECMA spec is confused here.

Since when is an "array-like view of a buffer"-object an array?

Doesn't the word "like" here preclude identity?

This is just the same as using String.charAt() 
and so declaring a string to BE an array,
instead of using charAt() to provide an "array-like view" of a string?

BUT, on the other hand, is an ordinary javascript array not just a 
"mechanism" to provide an "array-like view" of an underlying data buffer?


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

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


#28971

Fromjonas.thornvall@gmail.com
Date2015-12-04 09:23 -0800
Message-ID<c36b2f49-80bd-48e1-a61f-a86ee026a3b1@googlegroups.com>
In reply to#28965
Den fredag 4 december 2015 kl. 11:38:15 UTC+1 skrev John Harris:
> On Thu, 3 Dec 2015 11:17:44 -0800 (PST), jonas.thornvall@gmail.com
> wrote:
> 
>   <snip>
> >> does it mean Javascript have typed arrays or not?
> 
> The correct answer to your question is "yes and no".
> 
> Up to and including ECMAScript version 5.1 the answer is no : there is
> no such thing as a typed array. 
> 
> In ECMAScript version 6 there are typed array objects of various
> types.
> 
> Who do you hope will view your web site? If it includes people using
> older PCs then you should assume that it's version 5.1 being used, so
> no typed arrays.
> 
>   John

No it is only hobby project maybe making a compressed chessbok storing openings and grandmaster chess games without metadata only white and black paths for winning games. But that chessbook would of course need to be read in serverside into the structure.

But i was also thinking of a text/word sort reading in words by characters into a tree structure and just store the number of occurences of words.

Because it is basicly a bucket sort where buckets created by splicing in characters/objects at sublevels using object arrays.

One could also think of storing thick books or documents in a compressed format

For example the bible has 783,137 words the question is could one save space by just store a directory tree and for of course the words only written one time in the tree structure but you must also save either index of word, or the page and index in page it occurs. But there is seldom more than 1000 words on a page so i think 10 bits would be enough for page and 10 bits for index on page.

No one of course can question the time it would take to rebuild the compressed character/page/index structure into a book, but it is just to see   if it can be done. A normal compress probably alot more efficient.

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


#28960

FromStefan Weiss <krewecherl@gmail.com>
Date2015-12-03 20:29 +0100
Message-ID<n3q55u$aju$1@news.albasani.net>
In reply to#28956
On 2015-12-03 19:49, Evertjan. wrote:
> jonas.thornvall@gmail.com wrote on 03 Dec 2015 in comp.lang.javascript:
> 
>> It is not what is said at Stackoverflow they claim Javascript has typed
>> arrays. 
> 
> Nonsense, you are discussong by authority.

No idea what "discussing by authority" is supposed to mean, but typed
arrays do exist:
http://www.ecma-international.org/ecma-262/6.0/#table-49
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects#Indexed_collections

On 2015-12-03 18:48, jonas.thornvall@gmail.com wrote:
>> Example a byte array at first level where each element hold an integer
>> array? 

No idea what that is supposed to mean, either. A *byte* array where each
element is *not* a byte but an array?


- stefan

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


#28964

FromGene Wirchenko <genew@telus.net>
Date2015-12-03 13:23 -0800
Message-ID<7ec16bpc4trp70fkcuhqas3q9ijfcg3mqg@4ax.com>
In reply to#28960
On Thu, 03 Dec 2015 20:29:02 +0100, Stefan Weiss
<krewecherl@gmail.com> wrote:

>On 2015-12-03 19:49, Evertjan. wrote:

[snip]

>> Nonsense, you are discussong by authority.
>
>No idea what "discussing by authority" is supposed to mean, but typed

     The term is "argument from authority" or "appeal to authority"
and is a logical fallacy.

[snip]

Sincerely,

Gene Wirchenko

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


#28955

Fromjonas.thornvall@gmail.com
Date2015-12-03 10:06 -0800
Message-ID<2ce45b51-b85d-42c2-95cd-bbc74e0ecb89@googlegroups.com>
In reply to#28953
Den torsdag 3 december 2015 kl. 18:23:45 UTC+1 skrev Evertjan.:
> jonas.thornvall@gmail.com wrote on 03 Dec 2015 in comp.lang.javascript:
> 
> > Den torsdag 3 december 2015 kl. 00:42:27 UTC+1 skrev Evertjan.:
> >> jonas.thornvall@gmail.com wrote on 02 Dec 2015 in comp.lang.javascript:
> >> > Is there any limit to depth of an multidimensional array in
> >> > javascript? 
> >> 
> >> Javascript has NO multidimensional arrays !!!
> >> 
> >> Which dos not mean you cannot put an array in a single element of an
> >> array, but that is beside the point:
> >> 
> >> Javascript has NO multidimensional arrays !!!
> 
> > Hello can those arrays linke to elements in a hierarchy array type be of
> > different data types? 
> 
> Arrays do not link to elements.

Of course they must how could it else be done an array may be a stack, but subobjects must be linked weither they are arrays or not?

How would it otherways work do you think the subgroup is splice into the array without index? Or does it create an object, it can not be because the object would have to allocate space it must be a link to a memory location just like a FAT link to a sector and track. But here it is a link to physical memory adress.

> 
> The individual elements of javascript arrays:
> - are empty [meaning nonexistant, usefully conserving memory]
> - hold a variable value
> - hold an object, could be an array

Yes and that object is a linked to a memory adress holding another stack? 

> > Example a byte array at first level where each element hold an integer
> > array? 
> 
> Javascript arrays are all the same,
> there are no "byte arrays" or "integer arrays".

That is not what the link from Stackoverflow tells me.

> There are no "levels" that is just your imagination.

Of course there are levels of linking just like a directory tree with depth.
 
> This is just like asking if a javascript string can have a letter "p" at
> the 21st letter location when the 17th location is empty.

??? i am not sure what you try say here, do you try to say that the index 17 isn't there until you put p into 21?
 
 
> Please Jonas, for your own sake, do not invent things that are not there!

What isn't there other told me there is no problem building treestructures storing objects in an hiearach using javascript arrays.
 
> There is a difference in what you do on a programming level,
> and what javscript has to offer as a programming language.

Well it seem like it offer what i want to use it for creating a tree structure reading in words char by char at each level.

But you seem to say it is not possible, you really not that clear what you try to forward, let to the mist and tell what can an can't be done.

Do you understand what i try to do?
 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

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


#28958

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-12-03 20:21 +0100
Message-ID<XnsA565CF2A722D9eejj99@194.109.6.166>
In reply to#28955
jonas.thornvall@gmail.com wrote on 03 Dec 2015 in comp.lang.javascript:

> Den torsdag 3 december 2015 kl. 18:23:45 UTC+1 skrev Evertjan.:
>> jonas.thornvall@gmail.com wrote on 03 Dec 2015 in comp.lang.javascript:
>> 
>> > Den torsdag 3 december 2015 kl. 00:42:27 UTC+1 skrev Evertjan.:
>> >> jonas.thornvall@gmail.com wrote on 02 Dec 2015 in
>> >> comp.lang.javascript 
>:
>> >> > Is there any limit to depth of an multidimensional array in
>> >> > javascript? 
>> >> 
>> >> Javascript has NO multidimensional arrays !!!
>> >> 
>> >> Which dos not mean you cannot put an array in a single element of an
>> >> array, but that is beside the point:
>> >> 
>> >> Javascript has NO multidimensional arrays !!!
>> 
>> > Hello can those arrays linke to elements in a hierarchy array type be
>> > o 
> f
>> > different data types? 
>> 
>> Arrays do not link to elements.

You don't seem to know what a stack is.

A stack is a lifo memory, 
a heap where you put things on and take the newest one of again. 

> Of course they must how could it else be done an array may be a stack,
> but subobjects must be linked weither they are arrays or not? 

Given the right counters you can use an array as a stack.
But an array IS NOT a stack.

"how else?" is not an argument, just a lack of imagination.

You can define numerical values as pointers to a array element,
but that is just programming.


> How would it otherways work do you think the subgroup is splice into the
> array without index? Or does it create an object, it can not be because
> the object would have to allocate space it must be a link to a memory
> location just like a FAT link to a sector and track. But here it is a
> link to physical memory adress. 

You are mixing software implementation with programming.

You can use an array with a letter in each element as a string,
but a javascript array is not a string.


>> The individual elements of javascript arrays:
>> - are empty [meaning nonexistant, usefully conserving memory]
>> - hold a variable value
>> - hold an object, could be an array
> 
> Yes and that object is a linked to a memory adress holding another
> stack? 

Another "array", javascript has no "stacks". 

And you are wrong, there is no object that is linkes to an array, 
an array is a specialized type of object.
 
>> > Example a byte array at first level where each element hold an
>> > integer array? 
>> 
>> Javascript arrays are all the same,
>> there are no "byte arrays" or "integer arrays".
> 
> That is not what the link from Stackoverflow tells me.

Oh, well, I sullose you also see the bible as proven truth?

>> There are no "levels" that is just your imagination.
> 
> Of course there are levels of linking just like a directory tree with
> depth. 

No, there are not.

Your "of course" yous shows you are not able to explain and in itself hints 
at it being a false argument.

In software you can define a value as a link to an element in another array,
like I kan define "x23" to mean "Jonas-Thornval", but that is just your 
programming.

>> This is just like asking if a javascript string can have a letter "p"
>> at the 21st letter location when the 17th location is empty.
> 
> ??? i am not sure what you try say here,

It shows.

> do you try to say that the
> index 17 isn't there until you put p into 21? 

No, I say that a javascript string CANNOT have an empty position.

That a javascript string has indexes is just not true,
unles you define is so by your software.

And you cannot "put" a letter in an existing javascript string,
as it is not an array. You can make a software black box making is seemingly 
so, but the amount of cpu-time it takes will betray you.

>> Please Jonas, for your own sake, do not invent things that are not
>> there! 
> 
> What isn't there other told me there is no problem building
> treestructures storing objects in an hiearach using javascript arrays. 

You can do what you damn well like with software,
but understanding what javascript does and does not
will certainly help with the programming and the debugging.

>> There is a difference in what you do on a programming level,
>> and what javscript has to offer as a programming language.
> 
> Well it seem like it offer what i want to use it for creating a tree
> structure reading in words char by char at each level. 

You can do what you damn well like with software,
but understanding what javascript does and does not
will certainly help with the programming and the debugging.
 
> But you seem to say it is not possible, you really not that clear what
> you try to forward, let to the mist and tell what can an can't be done. 

No, many things can be done by programming, 
you can make a javascript array ACT like a string, 
but you cannot make that array BE a javascript string.

So if you say "javascript HAS multilevel arrays", you are WRONG.

> Do you understand what i try to do?

Certainly, you are trying to make an ass of yourself.
You are making claims that javascript IS what it ISN'T,
and DOES wat it DOESN'T DO.

If you use these false assumptions, 
your programmes will be needlessly badly written, 
and if thay work at all, 
they will take far more cpu-time than necessary,
and the debugging will be difficult if not near impossible.

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

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


#28963

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2015-12-03 21:00 +0100
Message-ID<2217362.3QoO8xFBVx@PointedEars.de>
In reply to#28953
Evertjan. wrote:

> jonas.thornvall@gmail.com wrote on 03 Dec 2015 in comp.lang.javascript:
>> Den torsdag 3 december 2015 kl. 00:42:27 UTC+1 skrev Evertjan.:
>>> jonas.thornvall@gmail.com wrote on 02 Dec 2015 in comp.lang.javascript:
>>> > Is there any limit to depth of an multidimensional array in
>>> > javascript?
>>> Javascript has NO multidimensional arrays !!!
>>> 
>>> Which dos not mean you cannot put an array in a single element of an
>>> array, but that is beside the point:
>>> 
>>> Javascript has NO multidimensional arrays !!!
>> Hello can those arrays linke to elements in a hierarchy array type be of
>> different data types?
> 
> Arrays do not link to elements.
> 
> The individual elements of javascript arrays:
> - are empty [meaning nonexistant, usefully conserving memory]

This does not make sense.  Empty elements are existing.

What you probably meant that there is the possibilty that array elements do 
_not_ exist insofar as there is no corresponding index.  Accessing array 
properties whose name is one of those indexes then yields the “undefined” 
value (not: “empty”).

> - hold a variable value

Nonsense.

> - hold an object, could be an array

Object references are values, so there are only two cases:

- non-existing element
- existing element with a value
 
>> Example a byte array at first level where each element hold an integer
>> array?
> 
> Javascript arrays are all the same,

You are underinformed.  As you have been told many times before, there is no 
“Javascript”, but several differing implementations of ECMAScript, where 
some of them contain “JavaScript” in their name.

> there are no "byte arrays" or "integer arrays".

You are also not paying attention.  See 
<news:23738591.vKiECokzl7@PointedEars.de>

Given your many misconceptions, a lot more humility on your part would 
certainly be appropriate.
 
Finally, your “From” header field value still does not specify a mailbox, 
and it could conceivably specify a mailbox that is not your own.  Which is 
anti-social behavior, in violation of Usenet/Internet standards and probably 
of the Acceptable Use Policy of your service provider, which could cost you 
your account if it is brought to their attention as it constitutes network 
abuse.  (I am reading this one posting of yours only because my killfile got 
reset.)

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail. 

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


#28944

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2015-12-02 16:50 -0800
Message-ID<d385de90-4a88-416a-a27c-e6d830ff4046@googlegroups.com>
In reply to#28940
On Wednesday, December 2, 2015 at 4:32:17 PM UTC-6, jonas.t...@gmail.com wrote:
> Is there any limit to depth of an multidimensional array in javascript?

JavaScript has 1-dimensional arrays, but arrays are first class objects, so you can nest them to get something analogous to a "multidimensional" array

<http://www.ecma-international.org/ecma-262/5.1/#sec-15.4>

You'll probably want to stay under 2^32-1 for each level of the array. Individual implementations may have one-off errors at this range.


> Let say i for some reason would like to store something similar to file and subfolder names in an directory tree similar array structure would that be possible?

You can represent tree structures with arrays, yes. 

> If so, do javascript allocate space dependent upon the depth of the multidimensional array?

JavaScript arrays can be sparse.

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


#28949

Fromjonas.thornvall@gmail.com
Date2015-12-03 07:10 -0800
Message-ID<05af76de-aff6-4ad8-b58c-0b3c3d991164@googlegroups.com>
In reply to#28944
Den torsdag 3 december 2015 kl. 01:51:08 UTC+1 skrev Michael Haufe (TNO):
> On Wednesday, December 2, 2015 at 4:32:17 PM UTC-6, jonas.t...@gmail.com wrote:
> > Is there any limit to depth of an multidimensional array in javascript?
> 
> JavaScript has 1-dimensional arrays, but arrays are first class objects, so you can nest them to get something analogous to a "multidimensional" array
> 
> <http://www.ecma-international.org/ecma-262/5.1/#sec-15.4>
> 
> You'll probably want to stay under 2^32-1 for each level of the array. Individual implementations may have one-off errors at this range.
> 
> 
> > Let say i for some reason would like to store something similar to file and subfolder names in an directory tree similar array structure would that be possible?
> 
> You can represent tree structures with arrays, yes. 
> 
> > If so, do javascript allocate space dependent upon the depth of the multidimensional array?
> 
> JavaScript arrays can be sparse.

Well i am not sure what you mean by level, i have two ideas i want to use that directory tree for first a combined bucket sort algorithm that create a  compressed tree, where each char is read into a bytearray another level of depth for each char. 

It can seem like a waste using 8 bit or more at each level but i probably want to reserve space for the frequensy of each word stored.

Could you even have arrays / objects of different types intelinked. Because at the deepest level you would also need to store how many times you read in that word.

So i am thinking of using it to sort things with just one comparisson of chars at each level and use splice to insert the elements/characters.

A more advanced version of this sort.

<HTML> 
<HEAD><TITLE>SORT</TITLE></HEAD> 
<BODY> 
<SCRIPT LANGUAGE="Javascript"> 
function jtsort(){ 
dist=document.encipher.cipher.value; 
dval = dist.split(","); 
countval= new Array(); 
for (j=0;j<256;j++){ 
countval[j]=0; 
} 

for (i=0;i<dval.length-1;i++){ 
 temp=dval[i]; 
 countval[temp]=countval[temp]+1; 
} 

temp2=0; 
valdist=""; 
for (j=0;j<256;j++){ 
  temp2=countval[j] 
  for (k=0;k<temp2;k++){ 
   valdist=valdist+j+","; 
  } 
} 

document.dasort.distrib.value=valdist; 
} 

</SCRIPT> 
<BODY> 
<TABLE WIDTH=100%><TR><TD BGCOLOR=BLACK ALIGN=CENTER WITH=50%> 
<FONT COLOR=WHITE> 
<FORM NAME=dasort onSubmit="jtsort(); return false;"> 
(n)sort ALGO 
<input type=submit value="SORT"><P> 
SORTED VALUES: 
<TEXTAREA TYPE=TEXT NAME=distrib COLS=40 ROWS=6></TEXTAREA><BR> 
</FORM> 
<FORM NAME=encipher onSubmit="encrypt(); return false;"> 
VALUES TO SORT: 
<TEXTAREA NAME=cipher COLS=40 
ROWS=6>99,22,191,216,69,26,255,126,56,3,206,77,50,84,193,10,7,64,244,173,16 2 
,72,84,162,27,245,33,133,249,201,9,128,78,135,74,115,135,26,237,12,147,89,2 3 
1,44,17,174,195,142,232,</TEXTAREA><BR> 
</FORM> 
</TD><TD ALIGN=CENTER BGCOLOR=WHITE WIDTH=50%> 
</TD></TR></TABLE> 
</BODY></HTML>

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


#28951

Fromjonas.thornvall@gmail.com
Date2015-12-03 07:23 -0800
Message-ID<e7197f6b-e967-47b8-b863-166a99258c73@googlegroups.com>
In reply to#28949
Den torsdag 3 december 2015 kl. 16:11:06 UTC+1 skrev jonas.t...@gmail.com:
> Den torsdag 3 december 2015 kl. 01:51:08 UTC+1 skrev Michael Haufe (TNO):
> > On Wednesday, December 2, 2015 at 4:32:17 PM UTC-6, jonas.t...@gmail.com wrote:
> > > Is there any limit to depth of an multidimensional array in javascript?
> > 
> > JavaScript has 1-dimensional arrays, but arrays are first class objects, so you can nest them to get something analogous to a "multidimensional" array
> > 
> > <http://www.ecma-international.org/ecma-262/5.1/#sec-15.4>
> > 
> > You'll probably want to stay under 2^32-1 for each level of the array. Individual implementations may have one-off errors at this range.
> > 
> > 
> > > Let say i for some reason would like to store something similar to file and subfolder names in an directory tree similar array structure would that be possible?
> > 
> > You can represent tree structures with arrays, yes. 
> > 
> > > If so, do javascript allocate space dependent upon the depth of the multidimensional array?
> > 
> > JavaScript arrays can be sparse.
> 
> Well i am not sure what you mean by level, i have two ideas i want to use that directory tree for first a combined bucket sort algorithm that create a  compressed tree, where each char is read into a bytearray another level of depth for each char. 
> 
> It can seem like a waste using 8 bit or more at each level but i probably want to reserve space for the frequensy of each word stored.
> 
> Could you even have arrays / objects of different types intelinked. Because at the deepest level you would also need to store how many times you read in that word.
> 
> So i am thinking of using it to sort things with just one comparisson of chars at each level and use splice to insert the elements/characters.
> 
> A more advanced version of this sort.
> 
> <HTML> 
> <HEAD><TITLE>SORT</TITLE></HEAD> 
> <BODY> 
> <SCRIPT LANGUAGE="Javascript"> 
> function jtsort(){ 
> dist=document.encipher.cipher.value; 
> dval = dist.split(","); 
> countval= new Array(); 
> for (j=0;j<256;j++){ 
> countval[j]=0; 
> } 
> 
> for (i=0;i<dval.length-1;i++){ 
>  temp=dval[i]; 
>  countval[temp]=countval[temp]+1; 
> } 
> 
> temp2=0; 
> valdist=""; 
> for (j=0;j<256;j++){ 
>   temp2=countval[j] 
>   for (k=0;k<temp2;k++){ 
>    valdist=valdist+j+","; 
>   } 
> } 
> 
> document.dasort.distrib.value=valdist; 
> } 
> 
> </SCRIPT> 
> <BODY> 
> <TABLE WIDTH=100%><TR><TD BGCOLOR=BLACK ALIGN=CENTER WITH=50%> 
> <FONT COLOR=WHITE> 
> <FORM NAME=dasort onSubmit="jtsort(); return false;"> 
> (n)sort ALGO 
> <input type=submit value="SORT"><P> 
> SORTED VALUES: 
> <TEXTAREA TYPE=TEXT NAME=distrib COLS=40 ROWS=6></TEXTAREA><BR> 
> </FORM> 
> <FORM NAME=encipher onSubmit="encrypt(); return false;"> 
> VALUES TO SORT: 
> <TEXTAREA NAME=cipher COLS=40 
> ROWS=6>99,22,191,216,69,26,255,126,56,3,206,77,50,84,193,10,7,64,244,173,16 2 
> ,72,84,162,27,245,33,133,249,201,9,128,78,135,74,115,135,26,237,12,147,89,2 3 
> 1,44,17,174,195,142,232,</TEXTAREA><BR> 
> </FORM> 
> </TD><TD ALIGN=CENTER BGCOLOR=WHITE WIDTH=50%> 
> </TD></TR></TABLE> 
> </BODY></HTML>

With a min and max search at each char and given 32 chars or 64 with capitals. Each char could be placed in correct in tree using 5 respective 6 comparissons followed by a splice.

That would make a real fast sort, because bucket / index sort is very fast but limited by the size of integer. One could of course have a min max sort upon the full strings and splice in the whole word in array but i feel that would create alot more comparissons than do it on charlevel in a directory tree structure.

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


#28950

Fromjonas.thornvall@gmail.com
Date2015-12-03 07:15 -0800
Message-ID<ff0d057d-db37-444d-aa4b-ce4e46e55272@googlegroups.com>
In reply to#28944
Den torsdag 3 december 2015 kl. 01:51:08 UTC+1 skrev Michael Haufe (TNO):
> On Wednesday, December 2, 2015 at 4:32:17 PM UTC-6, jonas.t...@gmail.com wrote:
> > Is there any limit to depth of an multidimensional array in javascript?
> 
> JavaScript has 1-dimensional arrays, but arrays are first class objects, so you can nest them to get something analogous to a "multidimensional" array
> 
> <http://www.ecma-international.org/ecma-262/5.1/#sec-15.4>
> 
> You'll probably want to stay under 2^32-1 for each level of the array. Individual implementations may have one-off errors at this range.
> 
> 
> > Let say i for some reason would like to store something similar to file and subfolder names in an directory tree similar array structure would that be possible?
> 
> You can represent tree structures with arrays, yes. 
> 
> > If so, do javascript allocate space dependent upon the depth of the multidimensional array?
> 
> JavaScript arrays can be sparse.

I am also thinking of creating a grandmaster chessbook using same technic. There probably is grandmasterchessbooks but i guess they take alot of space. Storing each game separat. Here they would be stored in a directory tree with intelinked draws overstored at each level, i am not really sure how one could store such though but it would be much like i file allocation table i guess.

[toc] | [prev] | [standalone]


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

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


csiph-web