HN user

avandecreme

57 karma
Posts4
Comments6
View on HN

This reminds me of when I learned to program on my casio calculator.

There was a function to detect a key press which would return a number identifying the pressed key.

I needed to map that number to the letter printed on the key to print it on the screen. I don't remember whether there was no hashmap data structure or I just didn't know about it, but I implemented it with a serie of if.

The problem with that solution is that while mapping A was fast, Z was very slow because it was at the end of the list. That is how I discovered divide and conquer/ dichotomy with if branches.

Ruby 2.6 8 years ago

Just parameters that are functions, except that you can only have one per function. I still fail to see the advantage of blocks over being able to pass functions as arguments like in other languages.