Tutorials about the Scala programming language.

Learning Functional Programming in Scala alvin April 23, 2017 - 8:30pm

Dateline April 23, 2017: I’ve decided to name my new book, Learning Functional Programming in Scala. I hope to have a first release of the book available by the end of May. Read below for more details.

Scala/FP book, coming soon alvin April 9, 2017 - 9:19am

I just counted, and the latest version of my book on Scala and Functional Programming currently contains 90 short lessons and another 25 appendices. It’s going to grow a little more, but that’s where it is right now. I hope to have a first draft of it publicly available by the end of April.

CBT, a Scala build tool alvin April 7, 2017 - 3:25pm

I haven’t tried it yet, but I was just reminded that Christopher Vogt (and others) have created a build tool named CBT as an alternative to SBT.

Writing at the beach alvin April 4, 2017 - 6:36pm

I’ve made some good progress on the Scala/FP book recently. For whatever reason I had been having writer’s block, so I came out to the beach for a little while to help clear out my brain, and today in particular was very productive. For a while now I’ve known how the book would end, but I was having a problem getting from where I was to the end, and I got through most of that today.

In a slightly related note, here’s a blurry photo of a military ship out on the ocean.

First draft of my Scala/FP book, coming soon alvin March 29, 2017 - 6:47pm

Health (and other things) permitting, I hope to have a first draft of my book on Scala and functional programming completed by the end of April.

It may only be in an alpha or beta state by then, but I’m debating about making it available as an Amazon ebook for a low cost at that time. I’ll be going back to work almost immediately after that, so if I don’t release it now, it may be another year before I can really finish it.

The target market for my book on Scala and Functional Programming alvin March 26, 2017 - 10:14am

Bonnie Eisenman perfectly captures the target market for my upcoming book on Scala and Functional Programming. How big that market is ... I don’t know ... I’m just trying to write a good book to explain functional programming in Scala in simple terms, and this is who I’m writing it for.

The origins of Scala alvin March 20, 2017 - 5:21pm

Here’s a nice 2009 article where Bill Venners interviews Martin Oderksy about the origins of Scala.

How to drop the first matching element in a Scala sequence

Summary: This blog post shows one way to drop/filter the first matching element from a Scala sequence (Seq, List, Vector, Array, etc.). I don’t claim that the algorithm is efficient, but it does work.


While creating some Scala test code earlier today I had an immutable list of toppings for a pizza, and I got into a situation where I wanted to remove the first instance of a topping.

How to write a Scala shell script that reads input from STDIN

As a quick note, if you need an example of how to write a Scala shell script that reads from STDIN (standard input) and writes to STDOUT (standard output), this code shows a solution:

exec scala -savecompiled "$0" "$@"


var line = ""
while ({line = StdIn.readLine(); line != null}) {
How to get cleaned HTML as a String from HTMLCleaner alvin March 11, 2017 - 2:35pm

If you ever need to get the “cleaned” HTML as a String from the Java HTMLCleaner project, I hope this example will help: