Last Switch(Ruby)

For general discussion related FlowStone
billv
Posts: 1165
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia
Contact:

Re: Last Switch(Ruby)

Post by billv »

RJHollins wrote:Obviously, still struggling to get a handle on the basics of RUBY. I'm hitting those posted RUBY sites to get familiar. My only programming 'experience' was using GFABasic on the ATARI ST back in the 80's.

Ruby sites are great for info....but for me it seems to be better just experimenting in FS.
I only know a little VB..so i know how you feel..trying to get a grip on this ruby monster...not easy..
RJHollins wrote:... i, firstsignal, secondsignal

Sounds like you almost made a "selector" here, using that "i" input..
Try using a boolean signal for that "i" input....and you'll see that "def event" thing more clearly..

Small question mark on "Output 0,V" method....
What if different inputs arrive at exactly the same time...???
There's no instruction in the code for this...what will ruby do?
I'm guessing its so remote it's a non-issue...not sure... :?
User avatar
chackl
Posts: 233
Joined: Tue Aug 17, 2010 8:46 pm
Location: Austria / Salzburg

Re: Last Switch(Ruby)

Post by chackl »

Just what i found out with ruby:

If you "add" ruby signals by linking them to the same Point a ruby Signal will not be added - It will "last-Switch"
I think this is great because it is much easier if you have to handle a lot of Switches :D

I created an example

Regards
Attachments
DATA_Switch_ruby.fsm
Ruby DATA last Switch example
(499 Bytes) Downloaded 1027 times
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: Last Switch(Ruby)

Post by RJHollins »

Thanks for the RUBY example chackl.

Just being made aware of different possibilities helps
:D
billv
Posts: 1165
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia
Contact:

Re: Last Switch(Ruby)

Post by billv »

chackl wrote:I created an example

So now were down to "output @in"...cool...
I'm glad i never showed some of earlier attempts at it :oops: :lol:
User avatar
chackl
Posts: 233
Joined: Tue Aug 17, 2010 8:46 pm
Location: Austria / Salzburg

Re: Last Switch(Ruby)

Post by chackl »

billv wrote:
chackl wrote:I created an example

So now were down to "output @in"...cool...
I'm glad i never showed some of earlier attempts at it :oops: :lol:


Just for your (personal) Note:
It is working and it is simple

If you do have any problems with it - DO NOT USE IT OR DO NOT MIND!
Or: CREATE SOMETHING BETTER
But please keep your useless advices for yourself or go to Facebook with that ^^

EDIT:
Sorry for those hard word - You are right it is NOT the developement of century ^^
This Example is should just to show how FlowStone calculates ruby-links. ;)

Regards
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: Last Switch(Ruby)

Post by RJHollins »

Hi Chackl,

Please, I think you totally miss read Billv response :o

The evolution of this 'Last Switch' code is now down to a single line ... that is some optimization !

Personally, I've had similar 'shock' as a piece of RUBY code that I've been working on ... and then see one of the GURU's reduce it down to a few statements ....

I've NOT wanted to post my version in comparison.
User avatar
chackl
Posts: 233
Joined: Tue Aug 17, 2010 8:46 pm
Location: Austria / Salzburg

Re: Last Switch(Ruby)

Post by chackl »

Sorry i read it a Little like "What do you want here..." :D
Sorry again :D - But since that there are thoes facebookkiddies are all over the Internet, you get also more "trash"-Help or comments on goog sites :D

Never mind :D - As an excusement i have another example here :D

With ruby you are not eaven able to Switch data very easy - you are also able to find out where the data came from :D

Here we are :D

Code: Select all

output @ins

This code Outputs als conected data to an Array - just one more letter ^^

Sorry again :D

Regards
Attachments
switch_data_text.fsm
(8.17 KiB) Downloaded 983 times
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
billv
Posts: 1165
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia
Contact:

Re: Last Switch(Ruby)

Post by billv »

chackl wrote:Sorry i read it a Little like "What do you want here.

Forget it...you've just miss interpreted..apology accepted
billv wrote:So now were down to "output @in"...cool...

Thats just me saying "Great, the code has been simplified even more"
The "cool" statement can be defined in context as "happy,content or impressed"
billv wrote:I'm glad i never showed some of earlier attempts at it

This line pays respect to the creator(s) of these simplified codes, by indicating how bad
my earlier attempts were.
Thanks for latest example...
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: Last Switch(Ruby)

Post by RJHollins »

These are the type of CODE examples that I want to put into the 'Code Librarian' that one of the GURUs posted here for the 'ToolBox'.

Great stuff !
8-)
Post Reply