An Identity function is a very basic function that takes one argument and the only thing it does is return the argument value. Pretty simple: f(x) = x
. This function is important in mathematics e.g in the Category theory, but is it useful in everyday programming?
I wrote about higher order functions in my last post and I mentioned their importance in Scala, but I didn’t want to digress too much. Now it’s time to introduce two great examples of higher order functions, map and flatMap. Map and flatMap are implemented for all collection types in the Scala collection library. They are quite significant functions in Scala, and functional programming in general, so they rightfully deserve their own post.
Read moreI find higher order functions to be one of the key properties of functional programming languages, as they enable functions to be first class values in a language. Per definition, every function that takes functions as arguments and/or returns functions as results is a higher order function.
Read moreAre you having troubles with Null Pointer Exceptions (NPEs)? Do you find it cumbersome to defend against them every few lines of code? If you’re not doing it already, you should probably try using Optionals in Java. Also known as Options in Scala.
Read moreI was asked a couple of times if I have a personal website, especially by non-techy friends who would assume that if I can build one I should have one. And I can’t say they’re wrong. But the answer was always no, with an iteration over various excuses and a feeling that I should probably do something about it. In some shape or form. As soon as I figure out the form.
Read more