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

Ruby (learning and language comparisons)

For general discussion related FlowStone

Re: Ruby (learning and language comparisons)

Postby MichaelBenjamin » Sat Mar 07, 2020 11:35 pm

.
Last edited by MichaelBenjamin on Mon Sep 21, 2020 10:35 am, edited 5 times in total.
MichaelBenjamin
 
Posts: 275
Joined: Tue Jul 13, 2010 1:32 pm

Re: Ruby (learning and language comparisons)

Postby MichaelBenjamin » Sat Mar 07, 2020 11:39 pm

.
Last edited by MichaelBenjamin on Mon Sep 21, 2020 10:35 am, edited 1 time in total.
MichaelBenjamin
 
Posts: 275
Joined: Tue Jul 13, 2010 1:32 pm

Re: Ruby (learning and language comparisons)

Postby trogluddite » Sun Mar 08, 2020 1:06 am

MichaelBenjamin wrote:i just keep wondering why the english do not use f.e.

Partly, our infamously snobby class system!

During the early years of English having it's spelling and grammar made formal, the academics doing it had a big hard-on for Latin. Knowing some Latin was how you proved to other people that you were well educated at a "posh" school, so we have some really stupid grammar rules from trying to force English to be more like Latin instead of like its Germanic roots.

The same is a bit true of the French words we got from when the Normans invaded us and became the rulers. For example; most farm animals have names with Germanic roots like the Anglo-Saxon farmers would have used; e.g. "swine". But the posh food cooked for the Lords and Ladies got the French versions; e.g. "pork".
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Ruby (learning and language comparisons)

Postby lalalandsynth » Sun Mar 08, 2020 2:25 am

MichaelBenjamin wrote:what would i need to write in a ruby codebox, to accept a string array from a FS primitive, search through that string array to find some string and then return the index i've found it at?

my guess, probably wrong:

Code: Select all
input flowstone_string_array
input string_to_look_for
output found_index// not needed since ruby returns last stuff automagically?

def find_first_occasion_of_string_in_string_array_by_idx(flowstone_string_array, string_to_look_for)
   for i in flowstone_string_array:
        if flowstone_string_array[i] == string_to_look_for
            return i
end// lol forgot that

find_first_occasion_of_string_in_string_array_by_idx(flowstone_string_array, string_to_look_for)



and as output i would get the matching string?


I would love to know ;)
User avatar
lalalandsynth
 
Posts: 600
Joined: Sat Oct 01, 2016 12:48 pm

Re: Ruby (learning and language comparisons)

Postby MichaelBenjamin » Sun Mar 08, 2020 3:55 am

.
Last edited by MichaelBenjamin on Mon Sep 21, 2020 10:35 am, edited 1 time in total.
MichaelBenjamin
 
Posts: 275
Joined: Tue Jul 13, 2010 1:32 pm

Re: Ruby (learning and language comparisons)

Postby MichaelBenjamin » Sun Mar 08, 2020 6:47 am

.
Last edited by MichaelBenjamin on Mon Sep 21, 2020 10:35 am, edited 1 time in total.
MichaelBenjamin
 
Posts: 275
Joined: Tue Jul 13, 2010 1:32 pm

Re: Ruby (learning and language comparisons)

Postby lalalandsynth » Sun Mar 08, 2020 12:27 pm

I will :)
User avatar
lalalandsynth
 
Posts: 600
Joined: Sat Oct 01, 2016 12:48 pm

Re: Ruby (learning and language comparisons)

Postby MichaelBenjamin » Sun Mar 08, 2020 1:20 pm

.
Last edited by MichaelBenjamin on Mon Sep 21, 2020 10:49 am, edited 1 time in total.
MichaelBenjamin
 
Posts: 275
Joined: Tue Jul 13, 2010 1:32 pm

Re: Ruby (learning and language comparisons)

Postby tulamide » Mon Mar 09, 2020 2:22 pm

After a few days, it came to my mind, why there might be another difficulty understanding OOP.

And that's from the conceptual part. OOP was not created to do lighter programming than before. It was created to shift a language away from the machine instruction base and towards human thinking. It's a high layer language.

If you're out on the streets and forgot your watch, you approach someone and ask: "Excuse me, could you please tell me the time?"
You would not do
01 shift x until x == xr
02 string_to_say = possible_sentences[3]
03 string_to_say.each { |chr| sync_mouth(chr) }
04 do_speak(mood_polite)

And so oop tries to hide the above, and lets you use what you know.

tulamide = Human.new(no_watch)
stranger = Human.new
tulamide.walk_to(stranger)
tulamide.ask_for_time(stranger)

It's just one aspect, but a conceptual one, that might confuse if you're used to try thinking like a processor works.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Ruby (learning and language comparisons)

Postby MichaelBenjamin » Tue Mar 10, 2020 5:29 pm

.
Last edited by MichaelBenjamin on Mon Sep 21, 2020 10:36 am, edited 1 time in total.
MichaelBenjamin
 
Posts: 275
Joined: Tue Jul 13, 2010 1:32 pm

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 58 guests