spacestr

🔔 This profile hasn't been claimed yet. If this is your Nostr profile, you can claim it.

Edit
Saman
Member since: 2024-11-18
Saman
Saman 7h

I asked one of these mass plagiarism machines to (re)produce for me a one-liner program in 20 popular languages. It's not possible to do in every language but of the ones that are Python and Ruby stood out to me as the most readable. Perl was the most concise but a bit magical looking. Here's the code: Python: print(sum(map(int, input("Enter integers: ").split()))) Ruby: puts gets.chomp.split.map(&:to_i).sum Perl: print eval join "+", split " ", <> The Ruby version is easier on the eyes and easier to write - you don't have to track parentheses and it lets you see clearly how data is being transformed one dot at a time. It's not necessarily more comprehensible as you don't know if those words are functions being called or properties being accessed. Python may be closer to English when you read it out loud but I really like the ability to call functions on objects as if those functions were methods. Other than looking neat, it makes it look like you're adding new capabilities to existing types. That's why Gambol allows both styles of calling functions when needed: print(sum(map(input(`Enter Integers: `).split(), Int.parse))) or input(`Enter Integers: `).split().map(Int.parse).sum().print() or for the fearless and the impatient: input.split.map(Int.parse).sum.print

Welcome to Saman spacestr profile!

About Me

Created Gambol

Interests

  • No interests listed.

Videos

Music

My store is coming soon!

Friends