September 28, 2021, 04:47:50

Author Topic: Two for one, NULL and setting all array elements to a default  (Read 843 times)

Offline jsalai

  • Jr. Member
  • **
  • Posts: 41
Re: Two for one, NULL and setting all array elements to a default
« Reply #15 on: July 07, 2021, 08:27:06 »
but this looks more like a list not like an array. Are users able to really build usable 3dimensional arrays with this?

The fundamental property of an array is, that the position of the values is fixed.

Of course!
It depends on programmers discipline...
I gave just a random example of how the dynamic array MAY look.
Every item whether literal or sub-array is precisely accessible by h(x)(y)....(z)
I use nested arrays (you may call them as lists or tables or whatever) in my practice.

Btw, all arrays whether dimensioned or not, are fully dinamic, so can be expanded, shortened, inserted etc.
Usually, just for reference, I write dim h(); as you can see from the example (which is complete!) that is NOT needed.
I won't belong to any organization that would have me as a member.
[Groucho Marx]

Offline Midimaster

  • Sr. Member
  • ****
  • Posts: 363
    • Midimaster Music Education Software
Re: Two for one, NULL and setting all array elements to a default
« Reply #16 on: July 07, 2021, 08:34:24 »
ah! now I understand the concept.
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

Offline bplus

  • Full Member
  • ***
  • Posts: 221
Re: Two for one, NULL and setting all array elements to a default
« Reply #17 on: July 07, 2021, 12:15:35 »
As jsalai points out, sb array handling truly first class. No restrictions on type in same array including items that are arrays themselves and inserting deleting elements is not a problem either.

For me arrays of arrays of arrays... is mind boggling, might make for some interesting fractals.

Offline jsalai

  • Jr. Member
  • **
  • Posts: 41
Re: Two for one, NULL and setting all array elements to a default
« Reply #18 on: July 07, 2021, 16:52:53 »
For me arrays of arrays of arrays... is mind boggling, might make for some interesting fractals.

As I stated, depends on programmers discipline.
Eg, when I need some operation on different objects (geometrical shapes of mechanical objects, for example) with different number of parameters (circle, semicircle, rectangle, triangle, etc), with different properties (colors, centroids, areas, etc) in strict predefined order (eg cut out a circle from a triangle which MUST exist), I put the arrays of their properties sequentially in a master array.
Now, to access them, I simply use:

for arr in master_arr
   do something with that "arr" depending on proprerties
next

Nothing mind boggling. Seems logical.

Now why this things in such a tool as SmallBasic when there are AutoCAD, Mapple, Mathcad, Maxima....
Because this works on an Android phone using a few megabytes...
And it is a fun to program it.
« Last Edit: July 07, 2021, 17:03:31 by jsalai »
I won't belong to any organization that would have me as a member.
[Groucho Marx]

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal