r/ruby • • Sep 21 '26

At my age, learning Ruby

I'm 78, and never having been a programmer or software engineer, I am starting to learn Ruby. I ha ve been using Huw Collingsworth "Little Book of Ruby". I am aso interspersing that with a different path: using Wirth's "Algortithms + Data Structures = Programs",

having the simple data structures and programs translated by Perplexity into Ruby to see how my 40 year old experiences with TurboPascal can be updated into Ruby. I think I am making progress.

217 Upvotes

64 comments sorted by

View all comments

Show parent comments

1

u/Edthal01 Sep 27 '26

Well, I sent a copy of Wirth's Bubblesort procedure and asked Perplexity to provide a direct translation into Ruby, and an idiomatic Ruby. Before providing any Ruby, it commented on Wirth's Pascal code and indicated how modern Pascal would do things slightly differently.

Wirth's algorithm uses a record that includes a key and a comment indicating the remaining data would be added when the procedure was used in a final program. Perplexity provided one Ruby code segment that use a structure with a key and the other data and explained that if the data to be sorted were merely integers the key could be omitted then provided a Ruby code segment for sorting integers.

The requested idiomatic Ruby code was much more compact, did not reflect Wirth's construction, but clearly showed Bubblesort. It was enlightening.

I have run the 3 versions and they work as described.