Choke On the Memory

A Salesman’s Guide to Non-Existence icon-external-link-12x12 icon-search-12x12 (track 02 from the Maps of Non-Existent Places LP by Thank You Scientist icon-external-link-12x12 icon-search-12x12 )
“A Salesman’s Guide to Non-Existence” Song Lyrics icon-external-link-12x12 icon-search-12x12

Thank You Scientist's "Maps of Non-Existent Places" album cover. [Formatted]

Blood on the Radio icon-external-link-12x12 icon-search-12x12 (track 04 from the Maps of Non-Existent Places LP)
“Blood on the Radio” Song Lyrics icon-external-link-12x12 icon-search-12x12
Suspicious Waveforms icon-external-link-12x12 icon-search-12x12 (track 06 from the Maps of Non-Existent Places LP)


The gents in Thank You Scientist icon-external-link-12x12 icon-search-12x12 follow an interesting business model: give music lessons while out on tour promoting an under-appreciated album.

Syntax Collisions

The Scala icon-external-link-12x12 icon-search-12x12 programming language is filled with all kinds of syntax abbreviations that can do a lot to make code clean, concise, and explicit. Typically these are useful and intuitive for someone who is familiar with the core language, but there are some that could be called cryptic, and maybe even deceptive. The following example is provided by the book Programming in Scala icon-external-link-12x12 icon-search-12x12 during a lesson on Pattern Matching icon-external-link-12x12 icon-search-12x12, and the authors may have omitted necessary explanations in previous sections for the reader to make successful attempts at its interpretation:

val withDefault: Option[Int] => Int = {
  case Some( x ) => x
  case None => 0
}

At first glance, the code looks very much like a variable declaration that collided with a function definition resulting in a new combined entity and some shrapnel (appearing in the form of Int = ). This is actually a function that returns an instance of Int, which is confirmed by its behavior:

scala> withDefault( Some( 10 ) )
res28: Int = 10

scala> withDefault( None )
res29: Int = 0

So it’s clear that withDefault is the variable’s name, but is it somehow also the type Option[Int]? This cannot be, but it is way too close to a variable declaration for comfort. So what’s going on? And if pattern matching is occurring—which it is—where did the match statement go?

It turns out the above function literal is shorthand for the following:

val withDefault = ( argument: Option[Int] ) => argument match {
  case Some( x ) => x
  case None => 0
}

This is unambiguous, while the abbreviated version is not: argument is supplied to the function referenced by the withDefault variable and then matching attempts are made against the cases Some(x) and None with either x or 0 being returned, depending on the match that is made. It’s also not that much longer, which makes a person wonder why the shorthand version was included in the language at all.

As a final note, the abbreviated form behaves the same as the following function literal, which uses Scala’s Placeholder Syntax icon-external-link-12x12 icon-search-12x12 to unshroud the argument:

val withDefault: Option[Int] => Int = {
  _ match {
    case Some( x ) => x
    case None => 0
  }
}

So the mystery has been solved, and it’s probably safe to say that this is not one of Scala’s better syntax maneuvers. The piece of code shrapnel Int = is the only oddity that remains, and this is present because the compiler needs the return type to be specified. Why can’t it make this inference in the original function when it was able to do so in the second and more reasonable definition? Fuck if I know. Maybe the compiler needs a token to appear there so that nonsense like => = doesn’t ever have to be considered valid. Regardless, this sure seems like a lot of trouble to save the programmer from typing a few extra characters on the keyboard.

Ain’t No Big Deal

I Kissed a Girl icon-external-link-12x12 icon-search-12x12 (track 02 from the One of the Boys LP by Katy Perry icon-external-link-12x12 icon-search-12x12 )

This was never the way I planned, not my intention
I got so brave, drink in hand, lost my discretion
It’s not what I’m used to, just wanna try you on
I’m curious for you, caught my attention

I kissed a girl and I liked it, the taste of her cherry chapstick
I kissed a girl just to try it, I hope my boyfriend don’t mind it
It felt so wrong, it felt so right, don’t mean I’m in love tonight
I kissed a girl and I liked it

No, I don’t even know your name, it doesn’t matter
You’re my experimental game, just human nature
It’s not what good girls do, not how they should behave
My head gets so confused, hard to obey

I kissed a girl and I liked it, the taste of her cherry chapstick
I kissed a girl just to try it, I hope my boyfriend don’t mind it
It felt so wrong, it felt so right, don’t mean I’m in love tonight
I kissed a girl and I liked it

Us girls we are so magical
Soft skin, red lips, so kissable
Hard to resist, so touchable
Too good to deny it
Ain’t no big deal, it’s innocent

I kissed a girl and I liked it, the taste of her cherry chapstick
I kissed a girl just to try it, I hope my boyfriend don’t mind it
It felt so wrong, it felt so right, don’t mean I’m in love tonight
I kissed a girl and I liked it

Dead Mechanical Crypt Creatures

dead-mechanical-crypt-creatures--000000-formatted

« Playlist »

Never Dead icon-external-link-12x12 icon-search-12x12 (track 06 from the TH1RT3EN LP by Megadeth)
“Never Dead” Song Lyrics icon-external-link-12x12 icon-search-12x12
Snuff icon-external-link-12x12 icon-search-12x12 (track 03 from the World Painted Blood LP by Slayer)
“Snuff” Song Lyrics icon-external-link-12x12 icon-search-12x12
Demon Eyes icon-external-link-12x12 icon-search-12x12 (track 06 from the One Kill Wonder LP by The Haunted)
Cryptorchid icon-external-link-12x12 icon-search-12x12 (track 06 from the Antichrist Superstar LP by Marilyn Manson)
“Cryptorchid” Song Lyrics icon-external-link-12x12 icon-search-12x12
I Don’t Mind the Pain icon-external-link-12x12 icon-search-12x12 (track 10 from the Danzig 4 LP by Danzig)
“I Don’t Mind the Pain” Song Lyrics icon-external-link-12x12 icon-search-12x12
Mechanical Mind icon-external-link-12x12 icon-search-12x12 (track 04 from the Target Earth LP by Voivod)
“Mechanical Mind” Song Lyrics icon-external-link-12x12 icon-search-12x12
Creature Lives icon-external-link-12x12 icon-search-12x12 (track 10 from The Hunter LP by Mastodon)
“Creature Lives” Song Lyrics icon-external-link-12x12 icon-search-12x12
Hand of Doom icon-external-link-12x12 icon-search-12x12 (track 06 from the Paranoid LP by Black Sabbath)
“Hand of Doom” Song Lyrics icon-external-link-12x12 icon-search-12x12