Apply Within - Bringing applicative desugaring to scala for-notation

Stupidly Obscure Programming in a Troubled Time

Since obsessively underlining passages in a tattered copy of Goodbye to Berlin hasn't proven to be the uplifting diversion I was hoping for, I resolved to bash my head against some really complicated scala code that I'm not qualified to write and that nobody is asking for either.

So that this exercise in self-abuse could pass for a reasonable use of my time - but not too reasonable, since that would be a giveaway - I decided to link it to an existing, longstanding obsession of mine: paradigms and constructs for concurrency.

Warning of what's …

more ...

Do you believe in magic?

Donald Knuth famously opined:

“The real problem is that programmers have spent far too much time worrying about efficiency in the wrong places and at the wrong times; premature optimization is the root of all evil (or at least most of it) in programming.”

I broadly agree. It's incredibly difficult to guess which parts of our code will turn out to be performance bottlenecks, and, conversely, which parts will become development bottlenecks because of the obscurity introduced by manual optimization. Eventually one develops instincts for this sort of thing, though they may be of less general applicability than we think …

more ...

Parallelize all the things -- Deconstructing Haxl, with Clojure macros, topological sorting and Quasar fibers

Parallel Lines

Select, few

Recently, there's been a lot of interest in DSLs to address the so-called N+1 selects problem, which describes the very common situation where you

  1. Do one database query to get a list of things, say user IDs;
  2. for each, call some sort of processing function that happens to
  3. do another query, say for each user's name.

It can be even worse than that, as in this example, where (for some reason) we want to append the last name of every person in a group to the first name of their best friend. (Maybe they're getting married.)

(defn …
more ...

Losing my religion: Switching to windows + linux under Hyper-V

(See Updates section at end for latest notes.)

virgil-n-me

In the middle of the journey of our life I came to myself within a dark wood where I was no longer comfortable identifying myself as a Mac user. Superficially, the relationship with my MacBook air had been rewarding. It lasted all day, ran the necessary few bits of commercial software I needed, and otherwise did a great job of pretending to be running unix. Also, I felt a pleasant sense of well-moderated individuality when my fellow developers and I exchanged knowing glances at our discreetly weathered, FP-inflected decal collections.

But there …

more ...

Scala Partial Functions Are Disgusting and Unnecessary

Thou whoreson zed! thou unnecessary letter!

- King Lear, 2.2.61

Partial functions are great in theory. By "great in theory", I mean that the basic idea is pretty simple but with very little additional research you can make weighty pronouncements involving the words "in" and "theory", as in, "in category theory, something something surjective algebra manifold."

The simplest example of a partial function is something like the logarithm, which isn't defined for arguments less than or equal to zero. Of course, it's also not defined for arguments that are strings or colors or egg-laying mammals, a restriction we usually …

more ...

Notes on Horrible Code

Recently, I came across some horrible, horrible code. I immediately pasted it into a messaging application and quickly received an expression of solidarity. With what though? My indignation? Grief? Amusement? I find it suspicious that code I consider horrible tends to have been written by people I already disliked for some reason.

Here are some things I have complained about recently:

  1. Code that was the source of a bug that was in retrospect obvious.
  2. Code that could be deleted with no change to the behavior of the program other than, possibly, a performance improvement.
  3. Extremely inefficient code, perhaps extravagant in …
more ...

Know when to fold 'em: visualizing the streaming, concurrent reduce

Holy cow! Can you believe your luck? What better way to spend some portion of whatever day of the week it is than to think about parallelizing reduction algorithms?

Really? You can't think of one? In that case, I'll kick off our inevitable friendship by contributing a clojure implementation of a fancy algorithm that asynchronously reduces arbitrary input streams while preserving order. Then I'll scare you with glimpses of my obsessive quest to visualize what this algorithm is actually doing; if you hang around, I'll show you what I eventually cobbled together with clojurescript and reagent. (Hint. It's an ANIMATION …

more ...

Spying on myself

Who knew that paranoia could be so generous? Not only does it allow you to worry about a larger fraction of the world's hazards, it can even increase the number of potential hazards for you to worry about.

I read ads on the subway, so I know that you can't be too careful these days. There are no bounds, for example, to the treachery my dog might be perpetrating while I'm hard at work, and it is essential, therefore, to have a 7 day rolling video archive of so that, say, 5 days after the shredding of a particularly valuable …

more ...

Impostor!

Zoltar

I took an "Impostor Syndrome" quiz consisting of the following 6 statements

  1. When people praise me for something I've accomplished, I'm afraid I won't be able to live up to their expectations of me in the future.
  2. At times, I feel my success has been due to some kind of luck.
  3. Sometimes I'm afraid others will discover how much knowledge or ability I really lack.
  4. When I've succeeded at something and received recognition for my accomplishments, I have doubts that I can keep repeating that success.
  5. I often compare my ability to those around me and think they may …
more ...

A minimalist translation of Clojure's core.async to Scala

Synecducers

Great computer languages, like monarchs and planets, become emblems of what surrounds them. The greatest computer languages are barely there, as nearly everything we file under their names could be described as a library or other customization. It's not unusual and not even absurd to find a question about socket() on a C language forum: Linux is arguably a morphogenic implication of C. Clojure, too, is formally minimal, but it induces composition. Much of what we specifically admire about it isn't the language itself so much as an expression of it.

Clojure provides Communicating Sequential Processes (CSP) via the …

more ...