How to Enable Filtering in a `for` Expression

Next, let’s see if we can use a filtering clause inside of a for expression with the Sequence code we have so far.

Trying to use a filtering expression

When I paste the current Sequence class and this code into the Scala REPL:

val ints = Sequence(1,2,3,4,5)

val res = for {
    i <- ints
    if i > 2
} yield i*2

I see the following error message:

A Quick Review of Scala’s ‘for’ Expressions

“The owls are not what they seem.”

The “Log Lady” in Twin Peaks


The goal of this lesson is to review at a high level how for loops work in Scala. This is necessary because Scala/FP developers take advantage of advanced Scala for loop features.

As an example of what I mean, the goal of the next few lessons is to explain what’s happening in this for loop:

How to Write Scala Functions That Take Functions as Input Parameters

“Haskell functions can take functions as parameters and return functions as return values. A function that does either of those is called a higher order function. Higher order functions aren’t just a part of the Haskell experience, they pretty much are the Haskell experience.”

From Learn You a Haskell for Great Good

How to drop the first matching element in a Scala sequence

Summary: This blog post shows one way to drop/filter the first matching element from a Scala sequence (Seq, List, Vector, Array, etc.). I don’t claim that the algorithm is efficient, but it does work.


While creating some Scala test code earlier today I had an immutable list of toppings for a pizza, and I got into a situation where I wanted to remove the first instance of a topping.

How to write a Scala shell script that reads input from STDIN

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:

exec scala -savecompiled "$0" "$@"


var line = ""
while ({line = StdIn.readLine(); line != null}) {

How to install Script-Fu scripts to work with Gimp (Mac OS X)

I couldn’t get the Gimp “Reflection” filter to work (on Gimp 2.8), so after a little digging around I found that the website has kept some of the Gimp scripts — called Script-Fu scripts — up to date. So I downloaded those scripts, and then had to figure out how to make them work in Gimp.

More examples of working with Gimp effects (filters)

In a previous article I shared a catalog of examples of Gimp filter effects. In this brief article/pictorial I’ll share examples of some of my favorite Gimp effects on a favorite image of a favorite dog. I don’t have a particular goal in this work, I just want to try out some different filters and effects and see where they lead.

The raw image

Here’s a raw image of a Siberian Husky named Zeus that I knew very well:

A gallery of 130+ Gimp filters/effects

There are times when I work on images a lot with Gimp, and then there are times when I don’t work with Gimp for a month or two. When I don’t work with Gimp a lot, I tend to forget about all of the different things I can do with. Therefore, I have created this page as a “Gimp special effects cheat sheet” page to help remind me of all the cool things I can do with Gimp effects.