Alvin Alexander | Java, Scala, Unix, Perl, Mac OS X

I woke up on the left side of a king size bed this morning. It wasn’t my bed, but I was blanketed in a thick, soft comforter, which felt wonderful. I looked around briefly. Wherever I was, the room seemed very nice. It was light outside.

I’m surprised when many functional programmers feel the need to say something bad about Scala. As a community, that makes them seem like a bunch of people who aren’t very nice. There are things I don’t like about Haskell, F#, Lisp, Scala, Kotlin, Go, Perl, PHP, Python, C, C++, etc., but I don’t feel the need to take pot shots at any languages or individuals.

This page is a work in progress, but if you need to create a secondary class constructor in Kotlin, I hope it’s helpful.

I haven’t read it yet, but I’m told that Cats, Cubits, and Teleportation is a clear description of quantum computing.

This is the amino acids supplement chart from the excellent book by Julia Ross, The Diet Cure. With this chart you look at the first two columns to find whatever “deficiency” problems you may be having, then look for the amino acid supplement(s) that are known to help with those problems.

I originally learned about this when my thyroid was failing in 2011. L-tyrosine was a major help in living through that problem.

The Diet Cure: Amino acids supplement chart

If you’re into puzzles and games of math and logic, The Riddler looks like it will be a good book when it comes out.

The Riddler - a book of puzzles, math, and logic games

I’ve been looking for a way to make Functional Programming, Simplified smaller, but haven’t yet found a way to do that while keeping all the essential information in it. But IMHO, it’s still a heck of a lot easier than reading all of these books on the right:

Once upon a time I lived in Alabama and had a 52-mile daily drive to work at a NASA facility in Mississippi, which gave me a lot of time to think. At one point on the trip you pass eight churches in ten miles — a friend referred to that stretch as “The highway to heaven” — and seeing weddings, funerals, and other gatherings at those churches led me to think about life, death, and spirituality.

I was very aware that I was a spiritual being since I was 16, but despite that I never cared for a religious framework; every church I’d ever been to seemed superficial compared to what I had experienced. That being said, I always thought prayer was a good thing — it helped to create a proper state of mind — so I tried to come up my own prayer, something I could believe in.

One idea I came up with was to write some sort of prayer that would honor the ancestors that led to my life on Earth. But, I thought, a problem with this approach was that my ancestors weren’t all that honorable. My mom is probably the nicest person in the world, so there was no problem there, but without getting into details, my dad, my grandparents, aunts and uncles ... there weren’t many people I was concerned about honoring.

Apparently 3M, which many people think of as a nice company, has known about the dangers of PFOA and PFOS — which is used to make Teflon and other products — for a long time. Per this story, “Internal studies and other documents show that 3M knew by the 1970s that PFOA and PFOS were toxic and accumulating in people's blood.”

“Mutable state is fine but needs to be contained and non-observable.” A quote from Jonas Bonér, which I saw in this tweet.

Mutable state is fine but needs to be contained and non-observable

Gimp 2.10.4 was released on July 4, 2018, and has some nice new features.

Gimp 2.10.4 is available

From a translation of the Tao Te Ching:

The master, by residing in the Tao (the Way),
sets an example for all beings.

Because he doesn’t display himself,
people can see his light.

Because he has nothing to prove,
people can trust his words.

Because he doesn’t know who he is,
people recognize themselves in him.

(I recommend that third stanza in particular for people who are interested in consulting.)

One thing I was reminded of recently is how consistent the Scala language is. Unlike other languages that have special conditions and special operators for those special conditions — leading to a big vocabulary for those languages — Scala is ... well, it’s just very consistent, and that’s a great thing.

(As a bit of background, I used to be annoyed that Scala didn’t have ++ and -- operators for integers, but after working with other languages, I now understand what Martin Odersky & Co. were trying to avoid.)

Table of Contents1 - Kotlin Arrays2 - Kotlin List functions3 - Kotlin Map functions4 - Kotlin Set functions5 - Summary: Kotlin List, Map, and Set creation functions

With Kotlin you can create lists, maps, and sets with standard functions that are automatically in scope. Here are those functions.

Here are three nice diagrams drawn by Mariko Kosaka that explain HTTP and HTTP2.

I can’t do most of these yoga poses right now (because of the whole colectomy surgery thing), but here’s a nice list of 12 yin yoga poses to awaken dormant energy and stuff.

Random thought of the morning: When I was young — maybe an early teenager at the oldest — I was talking to Sister #3 and said I wanted to have a baseball team worth of children. But then a few years later my dad got a woman who was not my mom pregnant, and my parents were divorced. Whatever notions I had about wanting a family and children were wiped out.

Part two of that random thought is that over the years I’ve been fortunate to meet a number of women (over 1,000 if you include school, work, and social events), and out of all those women there are only two who ever made me think, “I can see having children with this woman.”

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 rarely do you get a definition of what they mean.

Effects are related to monads

The first step in the process of understanding effects is to say that they’re related to monads, so you have to know a little bit about monads to understand effects.

I originally wrote a long introduction to this article, but I decided to keep that introduction for the 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 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 with Option values rather than match expressions.