The song, “Empty Garden (Hey Hey Johnny),” by Elton John and Bernie Taupin is one of my favorite “sad” songs, and a great tribute to John Lennon, who was one of my “peaceful” inspirations when I was growing up. In the song, I think there are at least two interpretations of the lyrics, “It's funny how one insect can damage so much grain,” and I’d like to share those here.
Scala, Java, Unix, MacOS tutorials (page 9)
“It was the 3rd of September...”
When I think of the song Papa Was A Rolling Stone, I think of the line, “And when he died, all he left us was a loan...”
(I never knew if the lyrics were supposed to be “alone” or “a loan,” but “a loan” is more accurate in the case of my father and family.)
“I would like my life to be a statement of love and compassion.”
~ Ram Dass
Many websites seem to have the wrong lyrics for the Dave Matthews song, Grey Street, so to help correct that problem, here are the correct lyrics for the long version of Grey Street that Dave Matthews played with Tim Reynolds at “Live at Farm Aid 2021”:
Daniel Ingram was the first meditation teacher I ever heard who said that we should make meditation fun. He said something to the effect that when we sit down to meditate, we should try to sense vibrations as fast as possible — like playing a video game — and said, “Let’s bust some vibrations!”
Famous meditation teachers on staying mindful 24x7
As I think about trying to make meditation fun — and the use of mantras — I recall meditation teachers who have talked about the importance of staying mindful all day — 24x7 — to achieve enlightenment. For instance, here are just a few quotes:
As a quick note to self, I wrote this Scala code as a way to (a) find the first element in a sequence, and then (b) return that element without traversing the rest of the sequence.
I initially thought about writing this code with a while
loop, for
loop, or for
expression — because I knew I needed a loop and a way to break out of a loop — but then I realized that an iterator would help me out here.
Also, please note that there is a potentially-better solution after this — the one that uses the “view.”
A first solution
So without any further ado, here’s this solution:
Here’s another A.I. faux painting. This one is based on the Matsuo Basho quote, “Do not seek to follow in the footsteps of the wise. Seek what they sought.”
(I find it hard to get this one right because it’s hard to differentiate what someone is seeking.)
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 20.3, “Scala best practice: Think "Expression-Oriented Programming".”
Problem
You’re used to writing statements in another programming language, and want to learn how to write expressions in Scala, and the benefits of the Expression-Oriented Programming (EOP) philosophy.
Because functional programming is like algebra, there are no null values or exceptions in FP code. But of course you can still have exceptions when you try to access servers that are down or files that are missing, so what can you do? This lesson demonstrates the techniques of functional error handling in Scala.
NOTE: This is a chapter from my book, Learn Scala 3 The Fast Way. Due to a mistake, this lesson was not included in the book.
When you write functions, things can go wrong. In other languages you might throw exceptions or return null values, but in Scala you don’t do those things. (Technically you can, but other people won’t be happy with your code.)
Instead what we do is work with error-handling data types. To demonstrate this I’ll create a function to convert a String
to an Int
.
If you like Scala 3 opaque types, check out Kit Langton’s Neotype project as a BIG improvement to opaque types. Neotype gets rid of the opaque types verbose boilerplate code, and offers many more improvements that you’ll like as you use this feature more often.
(Or, for more information about them, see my free “Opaque Types in Scala 3” training video.)
This is an excerpt from the Scala Cookbook, 2nd Edition. This is Recipe 23.9, Simulating Dynamic Typing with Union Types.
Problem
When using Scala 3, you have a situation where it would be helpful if a value could represent one of several different types, without requiring those types to be part of a class hierarchy. Because the types aren’t part of a class hierarchy, you’re essentially declaring them in a dynamic way, even though Scala is a statically-typed language.
As a “note to self” about using ZIO 2, here are a few ZIO examples that show the ZIO.fail
, ZIO.succeed
, ZIO.attempt
, orElseFail
, and orDie
methods and functions.
Before looking at the following code, it’s important to know that it uses the following Scala 3 enum
:
Regarding Jesus Christ, Maharaji began to cry and said, “He lost himself in the ocean of love.”
~ Maharaji (Neem Karoli Baba).
quoted in Miracle Of Love
I just came across this article where the author suggests that because of Elon Musk’s right-wing political actions, people boycott Tesla, advertisers should boycott Twitter/X, the FTC should sue him, and more.
September 1, 2016 was a day of rebirth for me. The previous day I was so weak, I couldn’t hold a carton of milk.
Crying in bed the next day, I decided something had to change, and eventually saw 26 doctors.
As this was going on, I wrote “Functional Programming, Simplified” (and the PDF is currently free!).
While many people use the word “enlightenment,” people who have made it there often prefer the words “awakening” or “liberation.” This is a faux painting in an impressionist style inspired by liberation.
“Love the poor. Serve them. Give everything to the poor, even your clothing. Give it all away. Jesus gave away all, including his body.”
~ Maharaji (Neem Karoli Baba).
quoted in Miracle Of Love
While many people think that Zen Masters live solitary lives in caves or monasteries, Bernie Glassman fed the poor, created a multi-million dollar bread company to employ the poor (and supply baked goods to Ben & Jerrys), raised $35M to home the homeless, and was a teacher to Jeff Bridges (“The Dude”). He also started his career as a mathematician and engineer. You can read more here, if you’re interested.