SALE: I’ve lowered the price of the PDF version of Functional Programming, Simplified to $20 for the 2019 holiday season. I don’t know when I’ll increase it again, but the usual selling price is as high as $35.
Tutorials about the Scala programming language.
When you get started with functional programming (FP) a common question you’ll have is, “What is an effect in functional programming?” You’ll hear advanced FPers use the words effects and effectful, but it can be hard to find a definition of what these terms mean.
With the Dotty compiler you can convert Scala 2 code to the new Scala 3 syntax, and with the Dotty 0.20.0-RC1 release on November 4, 2019, I thought I’d see how some of the conversions work. Almost all of the changes shown below have to do with the elimination of curly braces and the use of “significant indentation” syntax, but in one example I also show the
I originally wrote a long introduction to this article about Scala Options, but I decided to keep that introduction for a future second article in this series. For this article I’ll just say:
- idiomatic Scala code involves never using null values
- because you never use nulls, it’s important for you to become an expert at using
- initially you may want to use match expressions to handle
- as you become more proficient with Scala and Options, you’ll find that match expressions tend to be verbose
- becoming proficient with higher-order functions (HOFs) like
fold, and many others are the cure for that verbosity
I worked on some tools and processes today, so sometime soon we should have PDF, EPUB, and MOBI versions of “Scala Book” available.
One small step for me, and I don’t know if it will help mankind at all. But Hello, Scala is now called Scala Book, and you can find it here on scala-lang.org.
Here’s an example of Union Types in Scala 3 (Dotty). This image comes from this Martin Odersky video.
I recently created a command I named
ffx that lets you search your filesystem for files that contain multiple strings or regular expressions. This post describes and demonstrates its capabilities. (There’s a little video down below if you want to see how it works before reading about it.)
I’ve written this before, but when I saw this “pseudocode to Scala code” example in the book Functional Thinking, I thought it was worth mentioning again: If you have trouble grokking the Scala
map method, think of it as being named
transform instead. It transforms an input collection to an output collection, based on the algorithm you supply.
For those coming from the OOP world, I think “transform” is a better word because it is more meaningful, at least initially.