Improve Crystal's profile on Rosetta Code


There are a lot of code categories on Rosetta code with no Crystal examples.

An easy way to increase Crystal’s profile on the site, and in the coding world overall, is for people to provide the missing examples. The easiest way to do this is to just translate the Ruby version in each category, as a start.

Doing this would not only up Crystal’s profile, it would also be a good exercise for people (newbies, et al) looking to do something tangible with Crystal. This will surely benefit Crystal, by being more visible for more categories, and acting as coding tutorials too.

The instructions for adding new code is on the above site. It’s may be initially confusing at first (it was for me), but once you do it once it makes sense (it could be made much simpler though).


Previously added Miller-Rabin primality test.–Rabin_primality_test#Crystal

Just added Farey sequence (2019/3/23).


I;ve added several entries and it is somawhat funny (similar to adventofcode, without tests and easier, but at least you aren’t just throwing your time away).

But in many cases you can just copy Ruby solution and fix syntax errors - this is boring and doesn’t seems to be the right way.


Submitting Rosetta Code examples works on multiple levels, for different types of people.

If you are a new (to Crystal) programmer, it’s a concrete way to learn the nuances of Crystal as compared to other languages. For the Farey sequence I learned (unfortunately) the Ruby example cannot be used. So I used the Lua version, and then went to Wikipedia to see where that implementation came from. So I learned a lot (on multiple levels) about what doesn’t work in Crystal and some math. In both cases I consider that a win-win.

The key point of the exercises is to start using Language X as a tutorial for the language. Like learning any subject, you start with the basics. If you already know the language, yes, it might seem boring (like taking Algebra 101 over again), but the examples are definitely helpful for people wanting to learn syntax, structure, and vocabulary for some language.

In fact for Crystal, the first thing to do is to translate the Ruby version, just to see the level of compatibility. I think people might be vexed to see how much Crystal’s typing system effects how much you have to do to get a direct Ruby translation to work.

Ultimately though, I hope it’s not arguable that having more Crystal examples is better, than not.