Scala "sum of squares" algorithm

I just read an article about a “sum of the squares” algorithm, and thought for a moment how I’d write it in Scala. As usual, it’s pretty easy:

List(2,3,5).map(Math.pow(_, 2)).sum

You can also use Scala’s fold or reduce methods, but for this algorithm, using sum is easiest.

Yahoo Mail Monday fail whale

If I can’t tell it’s Monday morning any other way, I always know it as soon as I go to check my email. Whatever they do on Sunday night or Monday morning, it almost always results in down time.

A Reverse Polish Notation calculator written with foldLeft in Scala

Chapter 10 of the book, Learn You a Haskell for Great Good!, is titled, Functionally Solving Problems. In that chapter, the author describes a “Reverse Polish Notation” (RPN) calculator. If you ever used an old Hewlett-Packard (HP) calculator, you might know what that is. (At least that’s where I first learned about RPN.)

You don’t have to read it all yet, but some of that discussion is shown in this image:

The Shrine of St. Therese, Juneau, Alaska

I’m not a religious person in the traditional sense of the word, but I do like to visit old churches when I’m on vacation. I haven’t made it to Juneau, Alaska, yet, but when I do I want to visit the Shrine of Saint Therese. (I saw this photo on Twitter some time ago. I’m sorry, but I don’t remember who posted it.)

Old Man

“No, no, no ... come on old man, just let me back up before you start walking behind me”, I mutter to myself, looking back behind the right side of my rental car. I had a twelve hour drive to get here, and now I need to move my car out of this parking space like the pretty girl at the front desk asked.


The two young men had been drinking in the open field in rural Kentucky most of the night. “Billy Ray”, Jimmy said, “ya know what I’m gonna do? I’m gonna shoot the next damn thing that moves.”

“Includin’ me, Jeemy?”, Billy asked.

“No, a course not you Billy. But anythin’ else, I’m gonna shoot it.” Truth be told, Jimmy knew it was late, and they’d likely just finish their beers and drunk-drive themselves home.

A song by Alan Parsons named Days Are Numbers (The Traveler)

A song by Alan Parsons named Days Are Numbers (The Traveler):

“The traveller awaits the morning tide
He doesn't know what's on the other side
But something deep inside of him
Keeps telling him to go
He hasn't found a reason to say no.”

Syndicate content