Page 1 of 2
array index size?
Posted: Fri May 10, 2013 1:09 pm
by tester
Is there a primitive, that shows how many elements (index size) are inside array of elements?
Array builder could output that information...
Re: array index size?
Posted: Fri May 10, 2013 2:24 pm
by RJHollins
If I understand correctly, the 'ARRAY' primitive has an integer out that shows the total number of entries in the array.
Re: array index size?
Posted: Fri May 10, 2013 2:55 pm
by tester
Which one primitive? Ah, that one. No. "Array builder" (paralel inputs) - this one outputs only the array, no index size. I used chain of "sort array" and "find max", to get the index, but I wonder if I'm missing something obvious/else.
Re: array index size?
Posted: Fri May 10, 2013 5:27 pm
by MyCo
...
Re: array index size?
Posted: Fri May 10, 2013 5:50 pm
by tester
Hey MyCo, dummy is the best!
I did not knew that trick.

Re: array index size?
Posted: Fri May 10, 2013 7:53 pm
by billv
tester wrote:Is there a primitive, that shows how many elements (index size) are inside array of elements?
Tester, I usually love your questions, because they always leave me completly headf**ked
There's always a bit of "twisted genius" there, that sends my brain reeling...
But this question above had me

...
After all this time mate, How did you miss something like that....????
maybe your never working in green???
Anyway, good to know that your actually human.

Re: array index size?
Posted: Fri May 10, 2013 8:11 pm
by RJHollins
I think 'tester' was just trying to give me an easy one to return help on !
More importantly .... MyCo ... Big thanks for the multiple techniques !
The 'dummy' and the RUBY were new for me ... THANKS!

But let me ask this ... from a programming perspective, is there any advantage using one or the other
I'm thinking in terms of efficiencies ... like speed of execution, or RAM usage, or file size, etc. This may not be the ultimate example to question this on, but I'm trying to get a better understanding how to best optimize.
Thanks again!
Re: array index size?
Posted: Fri May 10, 2013 9:45 pm
by tester
billv wrote:tester wrote:Is there a primitive, that shows how many elements (index size) are inside array of elements?
Tester, I usually love your questions, because they always leave me completly headf**ked
There's always a bit of "twisted genius" there, that sends my brain reeling...
But this question above had me

...
After all this time mate, How did you miss something like that....????
maybe your never working in green???
Anyway, good to know that your actually human.

"Hello world. I'm human."
-- tester
Never used (manually) that part/aspect, never knew it existed that way. But it proves (in both directions), that SM/FS is intiutive, i.e. you can get a lot of things even if you don't know how...

For some reason I thought that single-value prims just indicate that the array is not empty, and overlooked the whole thing.
RJ - I guess, the dummy method is for those who know/remember/understand, and step-by-step methods - for everyone else (like ruby for ruby-fans).

On more practical side, I guess you just need to remember to set up smart prims and selectable connectors into specific types manually; otherwise when you mess up with your project, some of them may change, nobody knows when.
Re: array index size?
Posted: Sat May 11, 2013 9:05 am
by MyCo
RJHollins wrote:But let me ask this ... from a programming perspective, is there any advantage using one or the other
I'm thinking in terms of efficiencies ... like speed of execution, or RAM usage, or file size, etc. This may not be the ultimate example to question this on, but I'm trying to get a better understanding how to best optimize.
Thanks again!
The "dummy" method is propably the most effictive in RAM/CPU usage. Although I have to note this: the dummy itself does nothing. I just use it in the Schematic to convert a string into an array. You can always connect an Integer input to an array output, with the same result.
The version with the "Array" primitive is not so good, because it duplicates an array everytime the array changes. So it doubles the RAM for a single array and the duplicating takes much CPU.
The Ruby version is just for demonstration, it doesn't make sence. I'm not sure how much CPU/RAM this takes, but I think the array is also duplicated on the input, so this might even be worse than the "Array" primitive.
Re: array index size?
Posted: Sat May 11, 2013 1:01 pm
by billv
tester wrote:SM/FS is intiutive, i.e. you can get a lot of things even if you don't know how...
Your not kidding there mate. I havn't got a clue what i'm doing but still getting results
