array index size?

For general discussion related FlowStone
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

array index size?

Post by tester »

Is there a primitive, that shows how many elements (index size) are inside array of elements?
Array builder could output that information...
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: array index size?

Post by RJHollins »

If I understand correctly, the 'ARRAY' primitive has an integer out that shows the total number of entries in the array.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: array index size?

Post 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.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: array index size?

Post by MyCo »

...
Attachments
array_size.fsm
(473 Bytes) Downloaded 1071 times
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: array index size?

Post by tester »

Hey MyCo, dummy is the best!
I did not knew that trick. :-)
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
billv
Posts: 1165
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia
Contact:

Re: array index size?

Post 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 :lol: :D
There's always a bit of "twisted genius" there, that sends my brain reeling...

But this question above had me :shock: :shock: ...
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. :D
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: array index size?

Post by RJHollins »

I think 'tester' was just trying to give me an easy one to return help on ! :lol:

More importantly .... MyCo ... Big thanks for the multiple techniques ! 8-)

The 'dummy' and the RUBY were new for me ... THANKS!
:D

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!
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: array index size?

Post 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 :lol: :D
There's always a bit of "twisted genius" there, that sends my brain reeling...

But this question above had me :shock: :shock: ...
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. :D


:mrgreen: :mrgreen: :mrgreen:

"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.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: array index size?

Post 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.
billv
Posts: 1165
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia
Contact:

Re: array index size?

Post 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 :D
Post Reply