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

“I have to get out of here because there are people in other places. There’s a whole world out there that I don’t know anything about.”

~ David Byrne of the Talking Heads, in this article

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 (sale!) on

PDF version of Functional Programming, Simplified

Paperback Book
Now $34.99 on Amazon

Print version of Functional Programming, Simplified

Kindle eBook
$14.99 on Amazon

Kindle version of Functional Programming, Simplified

I debated about whether or not to share this story publicly, but I think it may potentially be helpful for two groups of people, so I’m sharing it here. First:

  1. For victims of abuse, I want you to know that you’re not alone, and that your feelings (anger, etc.) are perfectly normal.
  2. Second, for people who meditate, I want to let you know that both good and bad memories can pop into your mind spontaneously as your meditation practice advances.

And now for the brief story:

As I noted in this tweet on July 26, 2021, my book, Functional Programming, Simplified, was the #2 best-seller in Amazon’s functional programming category that is actually about functional programming.

Functional Programming, Simplified: An FP best-seller

“I am a survivor. You can throw me in the jungle, and I’m going to come out with a fur coat, and a headband I made out of some leaves.”

~ Teddy Bridgewater, Broncos QB, July 28, 2021

This is a sample .gitignore file that I use for Scala SBT projects:

# bloop and metals

# metals

# vs code

# scala 3

# sbt

# eclipse

# intellij idea

# mac

# other?


I’ll update this file over time, but for now I just want to put an example gitignore file out here so I don’t have to try to remember which gitignore file I created last.

One final note: Some of those files/directories are unique to SBT, some are for IntelliJ IDEA, others are for Scala/Eclipse, and .DS_Store is Mac-specific. Use whatever you want/need.

Some of this is counter to recommendations, so buyer beware. More info:

Over the last week or two, no matter what else I do during the day or night — such as working on the Scala Cookbook v2, for Scala 3 — I’ve been taking the time to watch the beautiful sunsets here in Colorado. This is the sunset in Longmont, Colorado on July 18, 2021.

Sunset in Longmont, Colorado on July 18, 2021

Overhead the albatross
Hangs motionless upon the air

Strangers passing in the street
By chance, two separate glances meet
And I am you and what I see is me

And do I take you by the hand
And lead you through the land
And help me understand the best I can?

(Lyrics by Pink Floyd, slightly edited by me. The photo is of a rain cloud in Longmont, Colorado, on July 15, 2021.)

A rain cloud in Longmont, Colorado, on July 15, 2021

Dateline July 15, 2021:

The book is about 250 pages long, and I could easily charge $25 for it. But I want to make them available at as low a cost as possible to make it as inexpensive to learn Scala as possible.

Note that this book was released in October, 2018, and covers Scala 2. If you want a free version of a similar book, the online version of the Scala 3 Book is completely free.

This was the sunset in Longmont, Colorado on July 14, 2021. I missed most of it, but caught it right here near the end.

Sunset in Longmont, Colorado on July 14, 2021

These are some very brief notes on what I just did to get a 500GB microSD card to work with an Amazon Kindle Fire 10, so that I can store some very large files on that microSD card inside the Kindle Fire 10. The notes are cryptic, but hopefully they’ll make sense to me in the future, and may make sense to you as well.

A lot of times people ask me, “How can I learn Scala 3?” Or, “I have this Scala 3 question, can you answer it for me?” I don’t mind doing that when I can, but there are still a lot of things I don’t know off the top of my head.

So, in an effort to help people find Scala 3 resources, here’s a quick list:

Also, if you’re using Scala 3 and have a specific question about it, I recommend asking that question here:

If you have a more general question about Scala 3, or even an idea on how to improve it, I recommend asking those types of questions here:

In summary, if you need some direct links to Scala 3 learning resources, I hope those are helpful.

As a brief tip today, in Scala 3 you can run a script as follows. First, put this Scala 3 code into a file named Hello.scala:

@main def hello = println("Hello, world")

Next, at your operating system command line, run your script like this:

$ scala Hello.scala
Hello, world

For a little script with no dependencies, that’s all you need to do.

“In the beginning, meditation is something that happens within your day. Eventually, the day becomes something that happens within your meditation.”

~ From “The Science of Enlightenment: How Meditation Works

You are not your thoughts.

As you learn in this meditation technique, it’s easily possible to sit back and observe all the crap that spews out of your brain. As you’ll quickly find out, “you” are the observer, and all those thoughts — I’m too fat, I’m not smart enough, I’m too sexy for my shirt — just keep spewing out of your socially-conditioned brain machine.

Observing the thoughts is the beginning of ending them.

Shinzen Young hear/rest noting medtation technique

The sunset in Longmont, Colorado on July 9, 2021.

The sunset in Longmont, Colorado on July 9, 2021

Tho’ much is taken, much abides; and tho’
We are not now that strength which in old days
Moved earth and heaven, that which we are, we are;
One equal temper of heroic hearts,
Made weak by time and fate, but strong in will
To strive, to seek, to find, and not to yield.

~ Part of the poem Ulysses, by Lord Alfred Tennyson

(In the process of writing Functional Programming, Simplified, I had to make thirteen trips to the emergency departments of three different hospitals. So this poem has some meaning to me.)

I originally wrote a long introduction to this article about how to work with the Scala Option/Some/None classes, but I decided to keep that introduction for a future article. 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 Option, Some, and None
  • initially you may want to use match expressions to handle Option values
  • 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 map, filter, fold, and many others are the cure for that verbosity

Given that background, the purpose of this article is to show how to use HOFs rather than match expressions when working with Option values.

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.

When I was writing Functional Programming, Simplified (FPS), I looked for ways to make everything easier. Then I found this game. The idea is to learn chess moves in a small setting, so you can then take them to a full chess board. It’s one reason FPS ended up with 130 micro-lessons.

Solitaire Chess, and making functional programming easier