Hacker News new | past | comments | ask | show | jobs | submit login

Ruby. I've done a range of languages, for example C, pascal, java, VB, PHP, javascript. But Ruby seems distinct from all of them in both syntax and concept (hashes, etc). I'd like to get to a point where I have a confidence that the programs I write are using efficient data structures and algorithms.



It's a great language.. and what makes it fun is the flexible nature of it..

I love the `x ||= 0` feature of the language, and miss it when working in elixir.

I also got to like the tailing if. `puts "hey" if x > 0`

Sometimes that things are pass by reference catches you buy surprise.

Now you can write efficient ruby, and structured algos too. The language isn't primarily used for this, but it can be done. Or rather one can easily write inefficient code. I've had a co-worker say "I don't write my code to be efficient." I (not liking the guy) replied. "It shows"..

Most times though (from a practical POV) I've found the code isn't the slow part of many apps; it's the data (database/file/api's). Still writing better ruby, with smart use of memoization and loops is a great boon.


If you choose Ruby because it seems distinct in syntax and concept. I would recommend you to take a look at OCaml. Some keywords: immutable, functional, loop via recursion, accumulators, tail-call optimization, monads, pattern matching, type inference, ADT, etc A small hobby project I made with it: https://stackl.remikeat.com


I'd pick elixir over Ocaml. Same feature list, but it's a bit better in the documentation department.


Efficiency isn’t the goal of writing ruby. I think “thinking in ruby” can be expansive to you, but “how do I program efficient ruby” is actually antithetical to that.


Efficiently thinking in ruby is more what I was getting at, yes. Right now I'm spending a lot of time just conceptually deciding how to tackle things that in other languages would be a matter of using the right syntax.


Ah yes, wonderful! The koans sites used to be a great way to get into ruby not sure if they are anymore


Try doing Advent of Code with Ruby. It is perfect for that, much better than Python which is most popular according to the AoC users survey. At least it looks way more elegant and having lots of useful built-ins (.tally, .select/.reject, .count, .sum, .combination(n), .permutation(n), etc. etc.) does not hurt either.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: