Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

array index size?

For general discussion related FlowStone

array index size?

Postby tester » Fri May 10, 2013 1:09 pm

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

Re: array index size?

Postby RJHollins » Fri May 10, 2013 2:24 pm

If I understand correctly, the 'ARRAY' primitive has an integer out that shows the total number of entries in the array.
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: array index size?

Postby tester » Fri May 10, 2013 2:55 pm

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

Re: array index size?

Postby MyCo » Fri May 10, 2013 5:27 pm

...
Attachments
array_size.fsm
(473 Bytes) Downloaded 906 times
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: array index size?

Postby tester » Fri May 10, 2013 5:50 pm

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

Re: array index size?

Postby billv » Fri May 10, 2013 7:53 pm

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

Re: array index size?

Postby RJHollins » Fri May 10, 2013 8:11 pm

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!
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: array index size?

Postby tester » Fri May 10, 2013 9:45 pm

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

Re: array index size?

Postby MyCo » Sat May 11, 2013 9:05 am

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.
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: array index size?

Postby billv » Sat May 11, 2013 1:01 pm

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

Next

Return to General

Who is online

Users browsing this forum: No registered users and 27 guests