Scala, Java, Unix, MacOS tutorials (page 3)

If you like my books and want to earn a little extra income, I just started using the Gumroad “affiliates” program. Just sign up with Gumroad, link to one or more books, then hopefully make some sales and earn a little extra money.

I’m starting with a 30% commission, so if you sell a $10 book like Learn Scala 3 The Fast Way! you’ll earn $3, and if you sell a $20 book like Functional Programming, Simplified: Updated for Scala 3, you’ll earn $6 (USD).

If you’re interested, start the process here on You’ll also want to read their help page for Affiliates.

Become an affiliate for Alvin Alexander’s books

Here are two favorite quotes from Anandamayi Ma. I think almost all of this comes via Ram Dass, but at the moment I can’t remember what book I saw this in. So I assume that Ram Dass or one of his assistants spoke, wrote, or compiled almost all of the following, and I’ll link to one of his books once I can confirm this.

My book, Functional Programming, Simplified — 4.5-star rated on Amazon, their 6th-best selling book on functional programming, and 5-star rated on — is currently on sale in three formats (prices shown in USD):

PDF Format
$15 on

PDF version of Functional Programming, Simplified

Paperback Book
Now $29.99 on Amazon

Print version of Functional Programming, Simplified

Kindle eBook
$14.99 on Amazon

Kindle version of Functional Programming, Simplified

When I was writing my new functional programming book — Learn Functional Programming Without Fear — a few alternate titles for the book were:

  • Learn Functional Programming the Fast Way!
  • The Fastest Way to Learn Functional Programming
  • From Object-Oriented Programming to Functional Programming
  • Helping Object-Oriented Programmers Learn Functional Programming
  • Functional Programming for Objected-Oriented Programmers

That’s because I found out — almost by accident — that the fastest way for object-oriented programming (OOP) developers to learn functional programming (FP) goes like this:

Note: This tutorial is an excerpt from the Scala Cookbook, 2nd Edition.

As you can tell from one look at the Scaladoc for the collections classes, Scala has a powerful type system. However, unless you’re the creator of a library, you can go a long way in Scala without having to go too far down into the depths of Scala types. But once you start creating libraries for other users, you will need to learn them. This chapter provides recipes for the most common type-related problems you’ll encounter.

Scala’s type system uses a set of symbols to express different generic type concepts, including the concepts of bounds, variance, and constraints.

If you’re looking for a unique gift for yourself or the Scala computer programmer in your life, I just created these coffee mug designs here on my Patreon account. There are two different designs, one with four book covers and another with three book covers, and both of them completely wrap around the mug.

Supporting my Patreon account helps to keep me writing and teaching about Scala, so I’m trying to find new and unique ways to thank my supporters. If you like coffee, tea, or any other beverage in a mug, I hope you’ll like these new designs.

Alvin Alexander book covers on a coffee mug

Some of the computer programming books on the right side of this image are amazing, and I would never discourage anyone from reading the great ones.

But if you’re an object-oriented programming (OOP) developer who wants to start understanding functional programming (FP) over a weekend or a few nights of reading, that’s the goal of the new little book on the left: Learn Functional Programming The Fast Way. It takes you from Java/OOP to functional programming in the simplest possible step-by-step learning process.

FP for Java/Kotlin/OOP developers

I taught Java and OOP for many years, and have used other OOP languages like Kotlin, Python, and Flutter/Dart, so I understand both OOP and FP, and I think that helped to make this a simple book for learning FP.

I also wrote the FP book in the middle — Functional Programming, Simplified — and it’s about three times larger than the little book on the left. I based it on most of the FP books on the right, and it goes into many details that the book on the left doesn’t go into. It’s big, but it’s still easier than reading all the books on the right.

For OOP developers: The smallest, simplest functional programming book

October, 2022: I just released my new book, Learn Functional Programming Without Fear, and my aim is to make it a terrific functional programming (FP) book for all OOP developers, especially Java and Kotlin programmers.

As a personal statement, I have no interest in pushing FP on anyone, but if you’re an OOP developer who is interested in FP, I hope this book is helpful. If you have some experience programming in Java, Kotlin, and OOP, I believe you’ll be able to read the whole book over a weekend, or in several nights during a week.

Update: It’s now December, 2022, and the book is still a “#1 New Release” on Amazon!

Why Java and Kotlin?

Why Java and Kotlin?:

  • For both of them, it’s because they’re JVM-based languages (or at least they were initially).
  • For Java developers, it’s because Java has incorporated several aspects of Scala over the last 12 years (including features like lambdas and immutable collections classes)
  • And for Kotlin developers, it’s because Kotlin and Scala are so similar. (My understanding is that Martin Odersky even consulted on the creation of Kotlin.) I’ve seen people say that if you know Scala, you can learn Kotlin in a week, and vice-versa.

FP for Java, Kotlin, and OOP developers

Best FP book for OOP, Java, and Kotlin developers

I am without form, without limit
Beyond space, beyond time
I am in everything, everything is in me
I am the bliss of the universe
Everywhere am I.

~ Ram Kir

A friend of mine was a devout yoga practitioner, and even studied under B.K.S. Iyengar. Right before she passed away, she began to cry tears of joy, and said, “All is one, all is one.”

Last week I started a This week in Scala page, and I’m going to see if I can do another one this week. Without further ado:

I’m currently writing my new book, Functional Programming, Simplified (Updated for Scala 3) directly in LaTeX, and this is my “LaTeX cheatsheet” that I keep open all the time so I can copy and paste the LaTeX stuff I need while I write.

Note that I don’t use any LaTeX formula stuff, so most of this is pretty basic LaTeX stuff, though there are a few custom commands/functions that probably won’t make sense to anyone unless I share some more details.

Here’s my current LaTeX cheatsheet:

I don’t know if I’ll keep this going or not, but I was looking for a way to monitor “What’s new in Scala,” so I thought I’d create a “This week in Scala” page. Here’s what’s new the week of January 15-21, 2023:

On the personal front:

As I note in How to use fold on a Scala Option, if you’re using Scala and need to create a None of a specific data type, either of these two approaches will solve the problem:

val none = Option.empty[Int]    // Option[Int]
val none: Option[Int] = None    // Option[Int]

Both of those approaches create the None with the type Option[Int], as shown in the Scala REPL:

scala> val none = Option.empty[Int]
val none: Option[Int] = None

scala> val none: Option[Int] = None
val none: Option[Int] = None

As a “note to self,” I like some of Shinzen Young’s sayings/analogies/metaphors in the first core lessons of the Brightmind app. The ones that come to mind are:

  • Try to listen to your mental talk in your head just like it’s a sound in nature, like listening to a bird. In this way, “you” can observe the thoughts in your head as the fly by, without getting attached to them.
  • In regards to your awareness, you can think of it in two different ways: (a) aiming your attention at a spot/area, or (b) hugging a friend.

For more details, check out the Brightmind app.

In December, 2022, in Winchester, Kentucky, the Clark County Public Library Board of Trustees took up the matter to potentially ban a book in the library they oversee. The book is an award-winning LGBTQ+ memoir that was already located in the Adult section of the library, but that wasn’t enough for the “conservative” trustees. While the library has many other sexually-explicit books (think Fifty Shades of Grey), the trustees singled out this one book, eventually voting that this award-winning book “is restricted to individuals over 18 unless a parent or guardian gives written consent.

I was going to share my opinion on censorship when I saw the quote in the image I shared (from this article): “Censorship is like a forest fire. It begins with a single ember, and if it is not extinguished at the outset, it becomes a raging conflagration that consumes everything in its path.”

Book banning in Winchester, Kentucky

These are my abbreviated notes (Cliffsnotes) from watching the talk, What Functional Programming Can Learn From Object-Oriented Programming, by John De Goes. As a warning, the notes are incomplete, and just a reminder to me of some of the best and most important parts of the talk.

Relatively early on he notes that there are multiple ways to do Scala, but only one way to write Go code. This is both a pro and a con.

How about a simple functional programming book written with this style:

No monads.
No monoids.
No functors.
No category theory.
Just some Java & Scala code.

Robert Martin’s tweet about writing a new simple functional programming book (in Clojure) was shared with me here, and I like his initial wording on not worrying about monads, monoids, functors, and category theory. (I believe it was Eric Torreborre who shared a similar sentiment some time prior to this, that functional programming should be taught separate from category theory.)

I said almost the exact same thing five years ago in the beginning of my book, Functional Programming, Simplified, and then in Learn Functional Programming Without Fear I show how to start with Java/OOP code and slowly transition to a functional programming style with Scala/FP examples. Both books focus on simple, pragmatic functional programming source code examples, without getting lost in FP theory.

No monads. No monoids. No category theory. Just FP code.

Last night — December 18, 2022 — I started the process of updating my best-selling book, Functional Programming, Simplified. With this update the book is being updated to cover Scala 3, ZIO, and Cats Effect — none of which existed when I wrote the first edition of the book!

I’ll write more about this over time, but for now, click this link to learn more about Functional Programming, Simplified (Updated for Scala 3).

Functional Programming, Simplified: Updated for Scala 3!

As you might guess from looking at this collection of book covers, I LOVE writing about things like Scala and functional programming, but it pays about 1/10th of what programming does. To try to make it affordable to stay in the writing business, I’ve created this Patreon page. Any support is greatly appreciated 🙏 and will help keep me in the writing business.

Patreon page to support Alvin Alexander’s writing