Recursion: How Recursive Function Calls Work

An important point to understand about recursive function calls is that just as they “wind up” as they are called repeatedly, they “unwind” rapidly when the function’s end condition is reached.

In the case of the sum function, the end condition is reached when the Nil element in a List is reached. When sum gets to the Nil element, this pattern of the match expression is matched:

Shaman alvin March 25, 2017 - 9:22am

The Native American woman I met last week had an aneurysm and brain surgery last year. (She showed me the scar, and she’s fine now.) Before the aneurysm was discovered, she went to a shaman who’s well-known among Natives here. He lit something, made some smoke, did whatever else he does, then looked at her, put his finger on her forehead and said, “You are blocked here.”

Unfortunately she assumed he was referring to a mental blockage, and thought, “No, I’m an open person, he’s wrong.” Shortly after this, doctors discovered the aneurysm right where he pointed.

Burning candle behind your head

That moment where you’ve been working on something really hard at your desk, you solve it, then lean back, swivel your chair to the side, put your feet up on the desk in celebration, and then realize there’s a burning candle behind your head.


How to show the largest files under a directory on Mac OS X (Unix) alvin November 9, 2015 - 4:22pm

I haven’t solved my overall problem yet — which is how to fit 64 GB of music onto a tablet with 24GB free space — but I did solve another problem today: How to show the largest files under a directory on Mac OS X (and Unix systems). In this short tutorial I’ll demonstrate what I learned.

A command to show the largest files under a directory on Mac OS X

The Unix command that worked for me on my Mac OS X system is this:

How to use the ‘filter’ method to filter a Scala collection

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 10.17, “How to use filter to Filter a Scala Collection”


You want to filter the items in a collection to create a new collection that contains only the elements that match your filtering criteria.

How to view HTTP headers from the command line using curl

I’ve been working a lot on the next generation web server for the alvinalexander.com website lately, and as I’m looking at different HTTP accelerators, I keep wanting/needing to look at the headers returned by my web pages. A simple way to look at the HTTP headers from the command line is with the curl command, like this:

curl -I http://example.com/

Running this command against the main Google website, I see output like this:

The Linux ‘head’ and ‘tail’ commands

Linux head/tail FAQ: Can you share some examples of the Linux head and tail commands?

Sure. The Linux head and tail commands are very similar, so I've included them here together. The head command command prints lines from the beginning of a file (the head), and the tail command prints lines from the end of files. There's one very cool extra thing you can do with the tail command, and I'll show that in the tail example commands below.