scala

Tutorials about the Scala programming language.

Methods on the Scala collections classes, organized by category alvin November 18, 2017 - 4:10pm

When I wrote the Scala Cookbook, I gave each recipe and then each chapter my full attention. I thought that if I wrote each recipe as well as possible, and included important recipes in each chapter, well, I wanted each chapter to be worth the price of the entire book. That was my goal.

As a result of this effort -- and perhaps to the chagrin of my editor -- the Scala collections chapters ended up being 130 pages in length.

Slides from “Scala 2.13 and Beyond” alvin November 18, 2017 - 9:51am

Here’s a link to some slides from a Lightbend presentation titled, Scala 2.13 & Beyond.

Plain Functional Programming talk by Martin Odersky alvin November 10, 2017 - 9:10am

I haven’t had time to watch it yet, but here’s Martin Odersky’s Devoxx talk that’s titled, Plain Functional Programming.

Looking at some differences between Scalaz Task and Scala Future alvin October 29, 2017 - 6:04pm
Table of Contents1 - The Scala Future example2 - The Scalaz Task example3 - What happens when you call the Future twice?4 - What happens when you call the Task twice?5 - Is one approach correct?6 - Source code

Some time ago I was searching for something and came across this Reddit thread about this tweet from Timothy Perrett, who leads Scala teams at Verizon:

“The fact that #scala Future is not lazy just blows my mind. After years of using Scalaz Task, Future is now totally unusable.”

The last part of that tweet is a bit of hyperbole to me, as I’ve been using the Scala Future for a long time myself, and I’ve had no problems using it. That being said, the examples at the top of the Reddit page were interesting, so I decided to try to understand the differences.

jsoup worked well as a way to modifying HTML content using Scala alvin October 29, 2017 - 4:22pm

I’ve used HtmlCleaner many times before to read/parse HTML content, but jsoup worked well today as a way to modify HTML content using Scala.

How to write a Scala shell script that reads input from STDIN alvin October 29, 2017 - 1:52pm

As a quick note, if you need an example of how to write a Scala shell script that reads from STDIN (standard input) and writes to STDOUT (standard output), this code shows a solution:

#!/bin/sh
exec scala -savecompiled "$0" "$@"
!#

import scala.io.StdIn

var line = ""
while ({line = StdIn.readLine(); line != null}) {
    println(line)
}
A print version of Functional Programming, Simplified? alvin October 28, 2017 - 2:16pm

I’m debating about releasing a print version of Functional Programming, Simplified. While pondering that decision, I found this image that shows an approximation of Scala Cookbook digital/print sales that O’Reilly makes available to me.

Scalafmt, a source code formatter for Scala alvin October 28, 2017 - 2:15pm

Scalafmt is a source code formatter for Scala.

A By The Bay interview with Tim Perrett alvin October 25, 2017 - 12:03pm

By The Bay has a very interesting interview with Tim Perrett, whose resume includes leading Scala teams at Verizon, and being a founding board member of the Scala Center.

A few good quotes from him at the beginning of the article: “Unlike many people in our industry, I left school at a young age and did not attend university. My first job was actually working in a factory. My modus operandi is that hard work and dedication can overcome any problem ... humility is something that enables one to be open to the ideas of others. To conclude: Listen, be humble, and roll up your sleeves.”

Functional Programming, Simplified (Kindle sale) alvin October 22, 2017 - 8:46pm

Functional Programming, Simplified” is currently $15 on Amazon. Get it while you can, the price goes back up to $30 Monday night (October 23, 2017).