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

ifthenelse for arrays in ruby?

For general discussion related FlowStone

Re: ifthenelse for arrays in ruby?

Postby TheOm » Fri Jul 18, 2014 9:27 pm

What do you mean by ranges? It works for strings too:
Attachments
Schematic1_new.fsm
(594 Bytes) Downloaded 775 times
TheOm
 
Posts: 103
Joined: Tue Jan 28, 2014 7:35 pm
Location: Germany

Re: ifthenelse for arrays in ruby?

Postby tester » Fri Jul 18, 2014 9:46 pm

Thanks!

By ranges - let say that I'm not a good rubyist. :mrgreen:
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: ifthenelse for arrays in ruby?

Postby tester » Sat Jul 19, 2014 12:33 am

Small problem. If I change the input type from "string array" into "int array" - ruby module no longer works (empty ouptuts). Can this be fixed, so that there is no need to use text primitive between nodes?
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: ifthenelse for arrays in ruby?

Postby Tronic » Sat Jul 19, 2014 1:26 am

you mean this?
Attachments
battle_tester_vs_ruby.fsm
(602 Bytes) Downloaded 821 times
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: ifthenelse for arrays in ruby?

Postby tester » Sat Jul 19, 2014 1:56 am

Yes, thanks.
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: ifthenelse for arrays in ruby?

Postby RJHollins » Sat Jul 19, 2014 2:04 am

Tronic wrote:you mean this?

haven't checked the fsm ... but the file title gave a chuckle
:lol:
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: ifthenelse for arrays in ruby?

Postby tester » Sat Jul 19, 2014 2:35 am

It took me two minutes to realize the difference. Quotation marks. :-)

I'm in the middle of heavy brainstorming. Creating a cookbook according to TCM - yet another unusual application of FS. (yep, I hear these voices - definately with x64 cooking would be 2x faster :mrgreen:).
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: ifthenelse for arrays in ruby?

Postby tester » Tue Jul 29, 2014 11:58 pm

I have one more thing.
I'd like to convert one bigger array according to rules stored in two smaller arrays. Like this.

input array:
el1
el2
el3
el1
el3

contitions arrays ("=" separated to make it more readable; can be in two independent text files or like this):

el1=element1
el2=element2
el3=somethingelse
el4=andsomethingelsemore

output would be then like this:

element1
element2
element3
element1
element3

How?
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: ifthenelse for arrays in ruby?

Postby TheOm » Wed Jul 30, 2014 12:43 am

Combine your condition arrays into a Hash.
Then map the input array to the output using that Hash.
Attachments
hash.fsm
(459 Bytes) Downloaded 810 times
TheOm
 
Posts: 103
Joined: Tue Jan 28, 2014 7:35 pm
Location: Germany

Re: ifthenelse for arrays in ruby?

Postby tester » Wed Jul 30, 2014 5:15 pm

Thank you!
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

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 109 guests

cron