There are approximations of which in vanilla Ruby, but that’s the subject of another article entirely.
I could, though articles like this definitely fall more advanced. Here’s a thought, let me know what you think:
Articles come with an approximate difficulty rating and a “you need to know these concepts first” blurb at the top.
Good call on
nil, that’s always a fun one when getting started. You could use
p instead which would return the value and log it, I use it sometimes to debug.
Enumerable in Ruby is full of all types of fun methods, especially for practicing against. If you start taking all of those methods and reimplementing…
There are some interesting benchmarks over on this gist: https://gist.github.com/AlexWayfer/8affba5fa6b4f29b7cc1f22de9e85d9c
Alexander Popov and a few others are chiming in.
The short version is they come out slower as they’re not optimized in C, but if they were we’d get some interesting numbers.