functional programming

Learning Functional Programming in Scala alvin April 23, 2017 - 8:30pm

Dateline April 23, 2017: I’ve decided to name my new book, Learning Functional Programming in Scala. I hope to have a first release of the book available by the end of May. Read below for more details.

Scala/FP book, coming soon alvin April 9, 2017 - 9:19am

I just counted, and the latest version of my book on Scala and Functional Programming currently contains 90 short lessons and another 25 appendices. It’s going to grow a little more, but that’s where it is right now. I hope to have a first draft of it publicly available by the end of April.

The karma of writing a book

As I’m writing my new book on Scala and functional programming I started thinking, “What if the person who creates Skynet or the Matrix reads this book and suddenly understands how to create their evil invention? But ... if I don’t create this book, they’ll stay on their previous course in life to be a world-famous cookie baker.”

It’s quite a responsibility, knowing that you could be responsible for a future without great cookies.

Writing at the beach alvin April 4, 2017 - 6:36pm

I’ve made some good progress on the Scala/FP book recently. For whatever reason I had been having writer’s block, so I came out to the beach for a little while to help clear out my brain, and today in particular was very productive. For a while now I’ve known how the book would end, but I was having a problem getting from where I was to the end, and I got through most of that today.

In a slightly related note, here’s a blurry photo of a military ship out on the ocean.

First draft of my Scala/FP book, coming soon alvin March 29, 2017 - 6:47pm

Health (and other things) permitting, I hope to have a first draft of my book on Scala and functional programming completed by the end of April.

It may only be in an alpha or beta state by then, but I’m debating about making it available as an Amazon ebook for a low cost at that time. I’ll be going back to work almost immediately after that, so if I don’t release it now, it may be another year before I can really finish it.

The target market for my book on Scala and Functional Programming alvin March 26, 2017 - 10:14am

Bonnie Eisenman perfectly captures the target market for my upcoming book on Scala and Functional Programming. How big that market is ... I don’t know ... I’m just trying to write a good book to explain functional programming in Scala in simple terms, and this is who I’m writing it for.

Good news (finishing book), bad news (syncope)

March 4, 2017: I’m glad to say that I’ve found a good way to write the end of my book on Scala and functional programming, and I’m writing as fast as I can to get that completed. Unfortunately the bad news is that I started getting sick again this week (pre-syncope and syncope (passing out)), and it’s been slow going because of that. But if I can stay alive, I’m finally happy with how this book is working out.

Starting to write an immutable singly-linked list in Scala

Table of Contents1 - Background: What is a Cons cell?2 - What it might look like in Scala3 - Starting to create my own Cons class4 - My second effort5 - Defining my nil value6 - Defining Cons7 - Replacing the NilCons method bodies8 - Adding a toString method to Cons9 - The complete code at this point10 - I’d really like a :: method11 - Interested?12 - See also

For some examples in my new book on functional programming in Scala I needed to create a collection class of some sort. Conceptually an immutable, singly-linked list is relatively easy to grok, so I decided to create my own Scala list from scratch. This tutorial shows how I did that.

Back to top

Background: What is a Cons cell?

The first time I learned about linked lists was in a language named Lisp. In Lisp, a linked list is created as a series of “Cons” cells. A cons cell is simple, it contains only two things: