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

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:

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

Sunrise at Virginia Beach, April 9, 2017. No filters have been applied, this is what it looked like. :)

Ocean sunrise

Mama always told me not to look into the eye’s of the Sun ... sunrise in Virginia Beach, April, 2017.

Sunrise in Virginia Beach, April, 2017

Today (April 8, 2020) is a day off for me, so I woke up at 4:30am and went up on the roof of the apartment complex garage, and took a few photos of the Pink Moon. These are some small versions of the best Moon photos, along with one of the Sun, which was coming up behind me from the east as the Moon set in the west over the Rocky Mountains.

First, the “Pink Moon” setting over the Rockies:

Pink Moon setting over the Rocky Mountains

Last night I was chasing people who were putting bombs in buildings and flying shape-shifters (who I would later realize were on my side). When I started to catch up to them I’d find myself yelling, “please comply.” I give a “thumbs up” for the action/adventure part of the dream, but the writing and line delivery were just horrible.

~ a dream from April 8, 2017

Doctors have been treating me for “suspicion of mast cell activation syndrome (MCAS)” since 2016, and I recently got my first Covid vaccination shot. Here’s a quick summary of the experience.

Before the shot I took one Allegra pill, as usual, and then two Xyzal pills (where I normally take one a day, but as many as four).

I got the Pfizer vaccine shot, and quickly developed these symptoms:

A “Love” sign you might find at a rest area somewhere in Virginia.

Love (a Virginia rest area sign)

“In enlightenment, death has no relevance to one’s state of being.”

As I reflected on the meaning of Easter this morning, I remembered this quote from Tibetan lama, teacher, physician, sculptor, and painter, Chagdud Tulku Rinpoche. The quote is from his book, Life in Relation to Death.

As a note to self, if you see this sbt error message with sbt 1.4.8, it’s a known issue:

java.lang.NoClassDefFoundError: org/fusesource/jansi/AnsiOutputStream

The short solution to the problem is to upgrade to sbt 1.4.9 or newer. The problem and solution are discussed in this Github sbt issue.

Here’s a photo of a snow white tree in Louisville, Colorado, one day in March, 2018. I was headed to a doctor’s appointment in Louisville, so this was probably somewhere between 7-8:30am. The full size image (not shown here) may be the prettiest photo I’ve ever taken in Colorado.

A snow white tree, Louisville, Colorado

This is a photo of some white-tipped trees on a cloudy, overcast day in Louisville, Colorado, March, 2016 (a few miles east and south of Boulder, Colorado).

Louisville, Colorado: White trees on a cloudy day

A “Boulderstrong” sign at the King Soopers in Louisville, Colorado, to honor the people who were killed at the mass shooting in Boulder last week.

Boulderstrong: King Soopers in Louisville, Colorado

I got vaccinated this past week at Boulder Community Hospital, in Boulder, Colorado.

I got vaccinated (Boulder, Colorado)

Functional programming is interesting. On the one hand it’s very (extremely!) disciplined. But on the other hand, people can’t agree on certain definitions. As an example, here are the “three principles of functional programming,” from this tweet:

1. Orthogonal composability
2. Maximum polymorphism
3. Maximum deferment

Conversely, here are the “three pillars of functional programming,” from Functional and Reactive Domain Modeling:

1. Referential transparency
2. Substitution model
3. Equational reasoning

When I learned OOP I saw that it was based on several principles that everyone agrees upon. When I started learning FP (and later took two years to write Functional Programming, Simplified) I was surprised there wasn’t a single accepted definition of functional programming. I ran across the principles/pillars in the last two days and was reminded of that again.

macOS FAQ: How do I show a file’s character encoding?

On macOS you show a file’s character encoding using the -I option of the file command:

$ file -I file.txt
file.txt: text/plain; charset=utf-8

Here are two more examples, with and without the file command’s -I option:

$ file -I 00-intro.adoc
00-intro.adoc: text/plain; charset=utf-8

$ file 00-intro.adoc
00-intro.adoc: UTF-8 Unicode text, with very long lines

March 23, 2021, a day after the horrible assault rifle mass shooting in Boulder, Colorado, gave a us a day that looked a bit like Alaska. The ground here in Colorado never looks like Alaska, but today the mist in the mountains and overcast sky looked like Alaska, and made me feel a bit more like I was at home here.

An Alaskan day in Colorado

When I edit my own text, I make comments like those shown in the images. A few of my own:

  • Nice start — dig deeper
  • Just say what you mean
  • You lost me
  • Feels fake — write from the heart (or, write to your muse)
  • Passive!

When I write books I try to complete a chapter, then get away from it for at least a month, then come back and edit it like this.

The images here are from the excellent movie, Finding Forrester.

On editing writing

The Scala 2.13 collections updates introduced two new “chaining operations” named pipe and tap. Here’s a quick look at how they work, plus a little extra fun at the end.


pipe works like a Unix pipe, passing values to functions. For example, given this setup:

import scala.util.chaining._
import scala.language.implicitConversions

def plus1(i: Int) = i + 1
def double(i: Int) = i * 2
def square(i: Int) = i * i   // we’ll use this one later

As a brief note today, for the last year or so I’ve been experiencing various “visions” when I wake up at night. I mentioned them to a doctor recently, and he said, “No, you’re not crazy, they’re referred to as hypnagogic hallucinations.” I found out that more accurately, the ones I’m experiencing are known as hypnopompic hallucinations.

If you’re interested in what these look like, here are three that I experienced recently. I regularly see images of “splatter” on the ceiling, and they can be all sorts of color. Last night they were mostly black, but the night before that they were red and pink:

Hypnopompic hallucinations - color splatter on ceiling

Some time ago I was at a party, and there was a woman there that I didn’t know, but I felt like I knew her. It was a strange feeling, kind of like deja vu, but it had nothing to do with this party, just the feeling that I knew this woman. Maybe I had seen somewhere before, but I couldn’t place it.

When that thought first came to me I was talking to some other people, so I shrugged it off for the time being. It was relatively early and I figured we’d meet soon enough. A little while later a trash can became full, so I took the bag out of the can and walked it to a garbage can outside by the detached garage. After I put the bag in the can outside I turned around, only to be startled to see the woman standing there.

“How do I know you,” she asked.