“Notes,” a Scala + JavaFX demo application alvin January 21, 2018 - 7:58pm

I wrote a little “Notes” application using Scala and JavaFX to go along with my “Hello, Scala” tutorial. If you’d like to see how it works, here’s a two-minute video:

The source code for the project is at this Github URL:

A Scala ‘foldLeft’ function written using recursion alvin January 20, 2018 - 4:25pm

As a short note, here’s some Scala source code that shows how to write a foldLeft function using recursion:

Fun with Scala functions (andThen and compose)

Here’s a little fun with Scala functions, including the use of andThen and compose:

scala> val add1 = (i: Int) => i + 1
add1: Int => Int = <function1>

scala> val double = (i: Int) => i * 2
double: Int => Int = <function1>

scala> val addThenDouble = add1 andThen double
addThenDouble: Int => Int = <function1>

scala> addThenDouble(1)
res0: Int = 4

scala> val doubleThenAdd = add1 compose double
doubleThenAdd: Int => Int = <function1>

scala> doubleThenAdd(1)
res1: Int = 3

(Inspired by the book, Functional and Reactive Domain Modeling, and my own book, Learning Functional Programming in Scala.)

A little Scala “date” utilities class alvin January 20, 2018 - 2:36pm

Here’s some source code for a little Scala “date utilities” class:

Next medical procedure

If you come here for the Scala, I’m sorry that I haven’t posted much here lately. I have my next medical procedure coming up on January 29th, and then my body decided to have a cold and then the flu.

Bug reports for Functional Programming, Simplified alvin January 19, 2018 - 11:15am

If you own a copy of Functional Programming, Simplified, and would like to report any bugs, I started this Github repo so you can do that. Just report your bug under the Issues tab.

Scaladoc syntax examples (Scaladoc tags, wiki markup) alvin January 18, 2018 - 8:08pm
Table of Contents1 - An example of Scaladoc tags and wiki formatting2 - Sample Scaladoc output3 - Common tags4 - Scaladoc “wiki” character formatting tags5 - Scaladoc “wiki” paragraph formatting tags6 - Generating Scaladoc documentation with SBT7 - See Also8 - The Scala Cookbook

In this article I share some examples of Scala’s Scaladoc syntax, including common Scaladoc tags, and the wiki-style of markup that Scaladoc supports.


(this space left open to make room for the table of contents over there -->)


Back to top

An example of Scaladoc tags and wiki formatting

You can mark up your source code using Scaladoc tags as well as a wiki-like syntax. The following code shows many of the Scaladoc tags and a few of the wiki-style markup tags:

Scala “string to date” and “date to string” methods alvin January 17, 2018 - 5:38pm

Here are a couple of “string to date” and “date to string” methods. They’re written in Scala, but are easily converted to Java. They only use the Java Date and SimpleDateFormat classes:

How to convert a Java Date to a Long value alvin January 16, 2018 - 7:35pm

If you ever need to convert a Java Date to a Long, just call the getTime method on the Date instance. This Scala example shows the process: