Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The maximum size of a multidimensional array
#1
Hello.

A great programming language, very well thought out - the quintessence of what you need. Congratulations.

Question - what is the maximum size of array ?
Can it be enlarged?
In a one-dimensional array I managed to get to 1 million.
Below are sample data that I want to convert. I will write a CSV to array parser. However, there are e.g. 30 million rows of this data.
How to do it?

20210103 170000;3.724250;3.724550;3.724250;3.724250;0
20210103 170500;3.723850;3.725150;3.723650;3.724160;0
20210103 170600;3.724160;3.724160;3.723850;3.723850;0
20210103 170700;3.724250;3.724460;3.724250;3.724460;0
20210103 170800;3.724450;3.724450;3.722350;3.722350;0
20210103 170900;3.722150;3.723950;3.722150;3.723950;0
20210103 171000;3.724750;3.724750;3.724750;3.724750;0
20210103 171100;3.722850;3.723160;3.722560;3.723160;0
20210103 171200;3.723050;3.724250;3.723050;3.724250;0
20210103 171500;3.724150;3.724250;3.723250;3.723250;0
20210103 171900;3.723260;3.723450;3.722450;3.722460;0
20210103 172000;3.722950;3.723350;3.720850;3.723350;0
20210103 172100;3.724250;3.724250;3.724250;3.724250;0
20210103 172200;3.724260;3.724260;3.724150;3.724150;0
Reply
#2
(01-22-2024, 11:06 AM)Zuzikofon Wrote: Hello.

A great programming language, very well thought out - the quintessence of what you need. Congratulations.

Question - what is the maximum size of array ?
Can it be enlarged?
In a one-dimensional array I managed to get to 1 million.
Below are sample data that I want to convert. I will write a CSV to array parser. However, there are e.g. 30 million rows of this data.
How to do it?

20210103 170000;3.724250;3.724550;3.724250;3.724250;0
20210103 170500;3.723850;3.725150;3.723650;3.724160;0
20210103 170600;3.724160;3.724160;3.723850;3.723850;0
20210103 170700;3.724250;3.724460;3.724250;3.724460;0
20210103 170800;3.724450;3.724450;3.722350;3.722350;0
20210103 170900;3.722150;3.723950;3.722150;3.723950;0
20210103 171000;3.724750;3.724750;3.724750;3.724750;0
20210103 171100;3.722850;3.723160;3.722560;3.723160;0
20210103 171200;3.723050;3.724250;3.723050;3.724250;0
20210103 171500;3.724150;3.724250;3.723250;3.723250;0
20210103 171900;3.723260;3.723450;3.722450;3.722460;0
20210103 172000;3.722950;3.723350;3.720850;3.723350;0
20210103 172100;3.724250;3.724250;3.724250;3.724250;0
20210103 172200;3.724260;3.724260;3.724150;3.724150;0

I'm glad you like naalaa, but I'm not sure if it's a good language for data processing of that kind. Actually, I'm pretty sure it's a terrible choice of language for that Big Grin

Parsing a csv file shouldn't be much trouble. Simplified (everything put into a 2D array of strings):

Code:
' Content of data.csv:
' Thing;Number;Count;Name
' boat;13;42;Sven
' goat;141;1;August
' dude;1091.2;32;Johnny

data = []
' Open file.
f = openfile("data.csv")
if file(f)
    ln = frln(f) ' Try read a line of data from file.
    while ln <> unset ' If nothing could be read, an unset (null) variable is returned.
        ' Just split the string at every ; character and put it in the data array.
        data[sizeof(data)] = split(ln, ";")
        ' You could also have used the first line of the CSV (if it has a header) to create key and
        ' value pairs for the data in each row, so that data[n].Name contains the Name column for a
        ' row. Also, as it is now everything is stored as string.
        ' Try read next line.
        ln = frln(f)
    wend
    free file f
endif

' Print.
if sizeof(data)
    for i = 0 to sizeof(data) - 1
        for j = 0 to sizeof(data[i]) - 1  write data[i][j] + chr(9)
        wln
    next
else
    pln "Something went wrong"
endif

system "pause"

But I assume your problem is all about the memory. You can try adding a line like this somewhere at the top of your program:

Code:
#mem128000000

Memory is complicated in n7. A program starts with one "bucket" of memory and if it runs out of memory and garbage collecting doesn't help, it creates a second bucket. I think it can create a maximum of 10 buckets, but I'm not sure. "#mem", directly followed by a value, sets the bucket size in bytes. The default value is 8388608.

Also note that data will eat up a lot more memory than what anyone can think makes sense. Sorry Smile
Reply
#3
Thanks :-)
I set memory to 1024.000.000 then I managed to create a one-dimensional array into which I entered about max 15.000.000 values - 1234.123456
The application occupies... ~800MB in the system :-D
However, the language is fast. Congratulations.
There are systems for data analysis, but it is easy to encounter a "wall" there. Something that doesn't do exactly what you want, you have to spend a lot of work to get around it and look for any traps (like oddly calculated roundings). In your programming language, I have full control of what I want to do.
This is a numerical analysis, but also a visual analysis - a slightly more complicated matter. All I need is to draw a point, a straight line or a rectangle. Of course, also the necessary basic mathematical operations.

ExclamationQuestions.
Is there any way to make it move the entire array down? That is, he replaced the first position with the second one, the second one with the third one, etc. - then the last one would become vacant?
Or.
Is there any other possibility to upload the entire csv file to memory and NaaLaa would download the data (and save) to this file in memory and then save it to disk?

Not an important question, but maybe there is an easy answer - is it possible to change the IDE font?

I used to write in AMOS on Amiga. Your language has this atmosphere, I don't know how to write it well in English. Does what is needed quickly. Many people are looking for such a language. For example, for fast calculations or prototyping algorithms/advanced calculations. For example, electronics engineers to calculate some systems, mathematicians, financiers. For education.

Your language has a lot of potential. And I looked through many dialects.
It's hard to find though.
I found your language thanks to gotbasic.com - I looked through all of them there. Yours is the best. Smile

Even because you have IDE dark mode and easy color configurator.

This is just the beginning of my adventure, I will give you more complete user feedback soon.

For me, the most important thing is that after some time, when looking at the algorithm, I can easily read what it is doing.

It is readable
for k=1 to 10 step 0.5
next

Not readable enough:
for i in range(1, 6, 2):
for(int i=1; i<20; i++)
Reply
#4
(01-23-2024, 11:13 AM)Zuzikofon Wrote: Thanks :-)
I set memory to 1024.000.000 then I managed to create a one-dimensional array into which I entered about max 15.000.000 values - 1234.123456
The application occupies... ~800MB in the system :-D
However, the language is fast. Congratulations.
There are systems for data analysis, but it is easy to encounter a "wall" there. Something that doesn't do exactly what you want, you have to spend a lot of work to get around it and look for any traps (like oddly calculated roundings). In your programming language, I have full control of what I want to do.
This is a numerical analysis, but also a visual analysis - a slightly more complicated matter. All I need is to draw a point, a straight line or a rectangle. Of course, also the necessary basic mathematical operations.

ExclamationQuestions.
Is there any way to make it move the entire array down? That is, he replaced the first position with the second one, the second one with the third one, etc. - then the last one would become vacant?
Or.
Is there any other possibility to upload the entire csv file to memory and NaaLaa would download the data (and save) to this file in memory and then save it to disk?

Not an important question, but maybe there is an easy answer - is it possible to change the IDE font?

I used to write in AMOS on Amiga. Your language has this atmosphere, I don't know how to write it well in English. Does what is needed quickly. Many people are looking for such a language. For example, for fast calculations or prototyping algorithms/advanced calculations. For example, electronics engineers to calculate some systems, mathematicians, financiers. For education.

Your language has a lot of potential. And I looked through many dialects.
It's hard to find though.
I found your language thanks to gotbasic.com - I looked through all of them there. Yours is the best. Smile

Even because you have IDE dark mode and easy color configurator.

This is just the beginning of my adventure, I will give you more complete user feedback soon.

For me, the most important thing is that after some time, when looking at the algorithm, I can easily read what it is doing.

It is readable
for k=1 to 10 step 0.5
next

Not readable enough:
for i in range(1, 6, 2):
for(int i=1; i<20; i++)

Thanks for the nice words!

I used Amos and Blitz Basic a lot in the Amiga days, made many games in those languages.

You can delete an index in an array with 'free key <table>, <key>'. All arrays in n7 are hash tables, and for an "array" the key is the numeric index. So:

Code:
myArray = [13, 14, 9, 7]
free key myArray, 2

removes index 2 (which contains the number 9) and the array then looks like [13, 14, 7].

Arrays don't have fixed sizes, so you can always add something at the end with:

Code:
myArray[sizeof(array)] = 103

And you can insert a value at a specific index with 'insert <array>, <index>, <value>':

Code:
insert myArray, 2, 302

"Is there any other possibility to upload the entire csv file to memory and NaaLaa would download the data (and save) to this file in memory and then save it to disk?"

I'm not quite sure I follow you there, sorry Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)