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

On this Contributors thread I just saw this comment by Martin Odersky that I didn’t notice before: “For the moment Scala-3’s @main only covers a small subset of what Mainargs can do. But the plan is to extend that.”

This comment came after Li Haoyi shared an example of his MainArgs library, and it seems like the implication is that the @main annotation in Scala 3 may eventually be able to handle command-line arguments.

I just learned that you can show hidden characters like tabs and end-of-line/newline characters in vi/vim with its set list command. Just go into last-line mode with the : character, then use that command:

:set list

When I do that in my current file, the $ is used to show newline characters, and TAB characters show up as ^I:

exec scala "$0" "$@"$
println("Hello, world")$
^I// tab test$

If you ever need to show hidden/invisible characters in vi/vim, I hope this is helpful.

I just wrote this awk script to extract all of the Scala source code examples out of a Markdown file. It can easily be converted to extract all of the source code examples out of an Asciidoc file, which is something else I will do with it eventually.

Here’s the awk script:

    # awk doesn’t have true/false variables, so
    # create our own, and initialize our variable.
    true = 1
    false = 0
    printLine = false

    # look for ```scala to start a block and ``` to stop a block.
    # `[:space:]*` that is used below means “zero or more spaces”.
    if ($0 ~ /^```scala/) {
        printLine = true
        print ""
    } else if ($0 ~ /^```[:space:]*$/) {
        # if printLine was true, we were in a ```scala block,
        # so print the end matter, then make printLine false
        # so printing will stop
        if (printLine == true) {
            print "```"
        printLine = false
    if (printLine) print $0

This is a view of a portion of the Rocky Mountains, as seen from Longmont, Colorado, on December 31, 2020.

The Rocky Mountains, Longmont, Colorado, December 31, 2020

This is a view in Rocky Mountain National Park, on January 3, 2018. Sister #2 and mom was here, and we went into the park.

Rocky Mountain National Park, Jan. 3, 2018

If you know where to look, you too can find this 12,005’ altitude sign in Rocky Mountain National Park (RMNP), in the Estes Park, Colorado area.

12,000 feet up in Rocky Mountain National Park (Estes Park area)

Unfortunately this image (and accompanying video) are blurry — I didn’t want to get too close to them — but here are two moose in Rocky Mountain National Park, July 31, 2019.

Two moose in Rocky Mountain National Park

“Someone is always in the way.”

That was my predominant thought after living in Alaska, and then moving back to the Lower-48.

In Alaska you can go to a lot of places and find solitude, and when you go to the grocery store it isn’t crowded, but as soon as I came back to the Lower-48 I constantly found that someone was always in my way, standing in front of me, at the grocery store, at the post office, in the Rocky Mountain National Park, wherever.

Way back on December 31, 2010 I lived in Wasilla, Alaska, and planned on driving down to Seward to spend a few days around New Year’s there. But a bad ice storm and the inability to find the right size tire chains derailed my plans, and I ended up in Anchorage instead. But because of that, I learned that they have a great fireworks show in Anchorage on New Year’s Eve.

As I mentioned in my second Facebook post on that day, there’s an Alaska saying that goes, “There’s old pilots, and there’s bold pilots, but there ain’t no old and bold pilots.”

December 31, 2010: Aimed for Seward, ended up in Anchorage

I just noticed that if you want to see which developers contributed to a software release when using git, you can use this git command:

git shortlog -sn --no-merges 3.0.0-M1..3.0.0-M3

I just saw that on this Github page. As shown on that page, the resulting output looks like this:

80  Nicolas Stucki
73  Martin Odersky
64  Krzysztof Romanowski

Here are a few examples of the Scala 3 while loop syntax.

Scala 3 while/do syntax

First, here are some one-line examples. This is the preferred syntax, using the while/do keywords.

while i >= 0 do i = f(i)

When using Apple’s macOS Terminal application, sometimes you’ll issue the ls -l command and see @ characters in the ls command output, like this:

$ ls -l
total 1280
-rw-r--r--@ 1 al  staff   1695 Dec 24 17:19
-rw-r--r--  1 al  staff   4064 Dec 24 14:41
-rw-r--r--@ 1 al  staff  20580 Dec 24 14:41
-rw-r--r--@ 1 al  staff  15960 Dec 24 14:29

For me, seeing the University of Louisville (UL) and Texas A&M play this afternoon — December 30, 2015 — must be how it feels to see two of your kids fighting. When I went to UL I lived in the basement of the house on the left, and when I went to A&M I lived in that brick and cinder block place on the right.

As George Costanza would say, “An Al divided cannot stand.”

UL vs Texas A&M (Music City Bowl, 2015)

If you ever have 169 comments on a Github pull request, I learned last week that the Atom editor has a nice feature that lets you see which comments are open or resolved. 169 thank you’s to whoever created that.

Atom editor feature lets you see open/resolved Github PR comments

A few weeks ago I started my morning with some hot chocolate. :)

Started the morning with some hot chocolate

If you purchased the paperback or Kindle versions of “Functional Programming, Simplified,” I now have the ability to offer you a discount on the PDF version of the book.

To get the PDF for just $10 — a 50% discount — just send a proof of purchase to and I’ll send you a discount code and URL.

Proof of purchase

Since the paperback and Kindle versions are only sold through Amazon, “proof of purchase” can be a copy of your Amazon receipt. Please scrub out your credit card information and address before sending me the proof of purchase, I have no interest in that information.

This is a manual process, so if I get a lot of responses, turnaround time might be a little slow.

The fine print

  • All prices shown are in U.S. currency (USD)
  • Your email address will never be used for anything else except communications related to this offer

December 23, 2019:

Nurse at the hospital, as part of a questionnaire: Do you feel suicidal?

Me: Well, I want to be careful with this because I don’t want you to get the wrong idea ... I don’t mind living ... and I don’t mind dying, but this in-between stuff where you’re constantly sick and can’t work or have any fun ... it is ... very frustrating.

Nurse: So ... [long pause] ... not yet?

Me: Yes, that’s fine.

On December 23, 2019, after a couple of days in the hospital, I had a heart procedure. That’s not something you forget, especially two days before Christmas.

This is a photo I took of the entrance to El Sanctuario de Chimayo in New Mexico. My notes say that the church was opened in 1816.

The entrance to El Sanctuario de Chimayo

As I continue to work through photos, this is a photo of a painting of a church, which I believe I saw in the lobby of the La Fonda hotel in Santa Fe, New Mexico.

Painting of a church, La Fonda hotel, Santa Fe, NM