ifthenelse for arrays in ruby?

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

ifthenelse for arrays in ruby?

Post by tester »

How to make ifthenelse for arrays in ruby?

-> Input array
-> equals
-> conditions array
-> things to send to output
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Tronic
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: ifthenelse for arrays in ruby?

Post by Tronic »

tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: ifthenelse for arrays in ruby?

Post by tester »

...arrays...
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Tronic
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: ifthenelse for arrays in ruby?

Post by Tronic »

tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: ifthenelse for arrays in ruby?

Post by tester »

I just would like to simplify this.

Basically there will be few of such units, each for different comparator. This is for splitting a list of strings according to numeric parameter placed within these strings.
Attachments
Schematic1.fsm
(591 Bytes) Downloaded 1120 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Tronic
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: ifthenelse for arrays in ruby?

Post by Tronic »

can you post a logical example of what you want?
TheOm
Posts: 103
Joined: Tue Jan 28, 2014 7:35 pm
Location: Germany

Re: ifthenelse for arrays in ruby?

Post by TheOm »

You could use group_by.
Attachments
Schematic1_simple.fsm
(616 Bytes) Downloaded 1061 times
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: ifthenelse for arrays in ruby?

Post by tester »

Hi @TheOm.

Your solution still refers to ranges. I'd like to compare the input array to single element (what I posted above was unmodified module, that operates on ranges). Or rather...

@Tronic.

Simple case scenario. Let say that I have an array:

a
a
b
a
c
b
c

Concept:
Produce arrays of indexes that refer to specific values.

indexes @a
0
1
3

indexes @b
2
5

indexes @c
4
6

indexes @N
...
...

*

I'm still defining the concept, but I hope I made this one clear this time. :-)
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Post Reply