I write a lot of reductions: loops that combine every element from a collection in some way. For example, summing a vector of integers:

(reduce (fn [sum x] (+ sum x)) 0 [1 2 3])
; => 6

If you’re not familiar with Clojure’s reduce, it takes a reducing function f, an initial accumulator init, and a collection xs. It then invokes (f init x0) where x0 is the first element in xs. f returns a new accumulator value acc1, which is then passed to (f acc1 x1) to produce a new accumulator acc2, and so on until every x in xs is folded into the accumulator. That accumulator is the return value of reduce.

In writing reductions, there are some problems that I run into over and over. For example, what if you want to find the mean of some numbers in a single pass? You need two accumulator variables–a sum and a count. The usual answer to this is to make the accumulator a vector tuple. Destructuring bind makes this… not totally awful, but a little awkward:

(reduce (fn [[sum count] x]
          [(+ sum x) (inc count)])
        [0 0]
        [1 2 3 4 5 6 7])
; => [28 7]

Continue reading (1968 words)

This history is also available as a PDF or EPUB, which may be more pleasant for reading.

The argument goes like this.

Kink, leather, and BDSM do not belong at Pride. First, they aren’t actually LGBTQ: kink is also practiced by straight people (Baker-Jordan, 2021). Moreover, those queer people who do display kink at Pride expose vulnerable people to harmful symbols and acts. They wear pup hoods and rubber bodices, they dress in studded codpieces and leather harnesses, they sport floggers, handcuffs, and nipple clamps (lesbiansofpower, 2021; stellar_seabass, 2021). Some demonstrate kinky acts: they crack whips in the parade and chain themselves up on floats. Some have sex in public (kidpiratez, 2021).

These displays harm three classes of people. Children (and the larger class of minors, e.g. those under 18 or 21) are innocent and lack the sophistication to process what they are seeing: exposure to kink might frighten them or distort their normal development (Angel, 2021; Barrie, 2021). Asexual people, especially those who are sex-repulsed, may suffer emotional harm by being confronted with overt displays of sexuality (Dusty, 2021; roseburgmelissa, 2021). Finally, those with trauma may be triggered by these displays (stymstem, 2021). These hazards exclude vulnerable people from attending Pride: kink is therefore a barrier to accessibility (RiLo_10, 2021; Vaush, 2021).

Consent is key to healthy BDSM practice, but the public did not consent to seeing these sexual displays (Baker-Jordan, 2021; busytoebeans, 2021; prettycringey, 2021). By wearing leather harnesses and chaining each other up in broad daylight, kinksters have unethically involved non-consenting bystanders in a BDSM scene for their own (likely sexual) gratification (anemersi, 2021; Bartosch, 2020; Xavier’s Online, 2021a, 2021b). The lack of consent to these sexual displays constitutes a form of sexual assault (PencilApocalyps, 2021). At worst, the fact that children may be present in the crowd makes these displays pedophilia (Rose, 2021), and (if one is so inclined) exemplifies the moral degeneracy of the entire LGBTQ community and impending collapse of civilization (Dreher, 2021; Keki, 2019)1.

Not everyone holds all of these views, or holds them to this degree; this is a synthesis of one pole in a diverse and vigorous debate. Nevertheless, calls to ban kink at Pride remain a mainstay of Twitter and Tumblr every June. To some extent this position is advanced by anti-gay reactionaries on 4chan and Telegram channels (Piper, 2021), but this is not the whole story: many opposed to kink at Pride identify themselves as queer, or at least queer-friendly (Mahale, 2021).

Continue reading (76753 words)

Site Redesign

Hey y’all! It’s been, gosh, what, ten years? I finally finished a total site redesign: all-new backend, HTML, CSS, modern image formats, etc. It’s finally readable on mobile now!

There’s a lot of accumulated cruft in the database and filesystem–aphyr.com is old enough that it still has redirects for CGI scripts written circa 2005. While I’ve tried as hard as I can to preserve compatibility, older posts may not look great, or there might be subtle formatting/text-processing issues. If you notice anything that looks super broken, leave a comment (either on the post itself or here), and I’ll try to get it sorted out!

Continue reading (104 words)

Hey y’all. Doing some long-overdue upgrades on aphyr.com; service will be up and down for a few hours; emails might bounce, etc. as I get things sorted.

Update: All finished, thanks for bearing with me!

Continue reading (35 words)

Previously: Rewriting the Technical Interview.

Aisha’s hands rattle you. They float gently in front of her shoulders, wrists cocked back. One sways cheerfully as she banters with the hiring manager—her lacquered nails a cyan mosaic over ochre palms. They flit, then hover momentarily as the two women arrange lunch. When the door closes, Aisha slaps her fingertips eagerly on the pine-veneer tabletop. Where have you seen them before?

Continue reading (4219 words)

Previously: Typing the Technical Interview.

Update, November 2023: here are the full term rewrite and language macros which formed the seed of this story. These files include OO notation as well as the basic Algol syntax shown here. There is also a sketch of an object-oriented language with classes and inheritance, implemented as a Clojure macro. I do not remember writing it. It looks terrifying.

Continue reading (2997 words)

Previously: Debugging.

In this chapter, we’ll discuss some of Clojure’s mechanisms for polymorphism: writing programs that do different things depending on what kind of inputs they receive. We’ll show ways to write open functions, which can be extended to new conditions later on, without changing their original definitions. Along the way, we’ll investigate Clojure’s type system in more detail–discussing interfaces, protocols, how to construct our own datatypes, and the relationships between types which let us write flexible programs.

Continue reading (8286 words)

Stay Home

Stay home.

I’ve been talking to folks 1:1 about this, but from a scroll through the feed today, I don’t think the general community has caught on. COVID-19 is not fucking around. If we don’t contain or dramatically slow it, we are going to run out of health care workers, hospital beds, and equipment. People are going to die for want of care. This is not a problem of the distant future: recent modeling suggests that without a significant reduction in social contact, Seattle will exhaust healthcare capacity around two weeks from now. Other regions will not be far behind.

Continue reading (483 words)

In KSP Interstellar, thermal and electric rockets run on power–but producing power with a fission reactor (at least, with the technology accessible early in the tech tree) is frustrated by the high mass of the reactor and electric generator. We can beam power via microwaves, but early experiments revealed that moderately sized orbital fission reactors were not capable of producing sufficient power. We needed more. Lots more.

Solar panels collect energy from the sun; they’re lightweight and inexhaustible, but produce very little power compared to a full-size reactor. Moreover, their power falls off with the inverse square of distance to the sun, making them less effective for outer-planetary exploration.

Continue reading (780 words)