You need the Option class

Having studied a lot of Scala, and now moving back to C++, there are many things that you find in code “in the wild” that I used to find acceptable, but today I find a real eye sore. Many of those are things that experienced C++ programmers can easily agree to, such as avoiding functions […]

Posted at 11:50 on 2016/08/10 | 2 comments | Filed Under: Uncategorized | Continue reading

Primes below N, the sieve of Eratosthenes in Scala

I have been practicing coding tests again. One nice exercise I saw the other day was a sample from a HackerRank test: find the number of prime numbers less than N. Or tell how many primes are below a given limit. You can easily change the problem to pick the list of the said primes. It is such […]


I’m Nic, and this blog is my little “programming tricks” notebook. Whenever I see a cool piece of code I find interesting or useful I post it here, with theoretical remarks when appropriate. May post opinion pieces about technology too sometimes. — Nicolau Werneck <>


Get every new post delivered to your Inbox.

Join 729 other followers