An Algorithmic Lucidity

a blog

March 2015

Mock

Some people, when confronted with a Python unit-testing problem, think, "I know, I'll use mock." Now they have <MagicMock name='two_problems' id='140279267635776'>.

XXX II

// XXX: old_io is probably facing deprecation if names mean anything
#![feature(old_io)]
use std::old_io;
use std::collections::HashMap;

fn main() {
    let things_to_ask_about = ["name", "age", "username"];
    let mut collected_information = HashMap::new();
    for askable in things_to_ask_about.iter() {
        println!("What is your {}?", askable);
        let input = old_io::stdin()
            .read_line()
            .ok().expect("failure message here");
        // XXX EVIDENCE OF MY IMPENDING DEATH in these moments when I
        // want to scream with the righteous fury of a person who has
        // been genuinely wronged, on the topic of what the fuck is wrong
        // with this bullshit language where you can't even trim a string
        // because "`input` does not live long enough" this and "borrowed
        // value is only valid for the block suffix following statement 1
        // at 21:48" that
        //
        // But what the fuck is wrong with this bullshit language is in
        // the map, not the territory
        //
        // on the balance of available evidence, doesn't it seem more
        // likely that the borrow checker is smarter than you, or that
        // the persons who wrote the borrow checker are smarter than you?
        //
        // and if you can't even follow their work even after several
        // scattered hours of dutifully trying to RTFM, will an
        // increasingly competitive global Economy remain interested in
        // keeping you alive and happy in the decades to come?
        //
        // I am not a person who has been genuinely wronged, just a man
        // not smart enough to know any better
        collected_information.insert(askable, input.trim());
    }

    for (askable, response) in collected_information.iter() {
        println!("You claimed that your {} is {}.", askable, response);
    }
}

"Pi Day" Is an Unholy Festival of Sin That Is Corrupting Our Children

Dear reader, it's the fourteenth day of the third month of the year, and if you're reading this blog, some charlatans or overenthusiastic youth (the subject of whose enthusiasm is not what they think it is) have probably tried to convince you to celebrate it as "Pi Day." You see (these quacks implored you) π is around 3.14, and March fourteenth is 3/14. And furthermore (they may have put to you) furthermore this year's Pi Day is special, because it's 3/14/15, which is like 3.1415! Why (an especially impudent few might have continued to venture), we should plan some grand spectacle on 9:26 a.m. on the day, which is like 3.1415926! With (and this is the part that is most inevitable and offensive) pie! Get it, because it sounds like pi and is shaped like a circle?

Dear reader, it is lies or it is worse than lies; it is blasphemy, treason, superstitious superficiality, degenerate folderol, and frivolous depravity! Do not mistake me; of course I can see as clearly as any other ape can that the numeric subsequence of the string "3.14" is same as that of the string "3/14". The former string represents an occasionally useful approximation of the circle constant which is ubiquitous in mathematics (give or take a factor of two); the latter is how people in my country abbreviate today's date. Perhaps to those who don't have anything really interesting to think about, this trivial coincidence might be worth a passing mention; apes love anything for an innocent distraction, and why begrudge that?

What is intolerable, however, is for a mathematically meaningless coincidence to be marketed as a day to celebrate mathematics, which marketing can only propagate the cruel slander that mathematics is about memorizing and manipulating figures. Not that seekers of true mathematical knowledge don't have occasion to manipulate figures from time to time—we do—but we do it because the figures actually mean something. And the similarity between the decimal number "3.14" and the date "3/14" ... doesn't really mean anything. Our dominant culture happens to prefer a base-ten place-value system, in which the representation of the quantity π happens to start with 3.14. That means: three (times ten-to-the-zeroth), plus one-tenth (which is one times ten-to-the-negative-first), plus four one-hundredths (which is four times ten-to-the-negative-second), plus other terms that our to-two-decimal-places approximation neglects. Whereas 3/14 means: the fourteenth day of the third month. It's not the same number as 3.14, even if its standard representation happens to involve the same digits in the same order.

If there must be a Pi Day, I can imagine sensible arguments for holding it once every three years and fifty-two days (around π years), or on January fourth at 3:23 a.m. (about π days into the new year), or on one of the solstices or equinoxes (when the Earth is π radians around the sun from some imagined "zero" at the opposite solstice or equinox).

But March fourteenth? What is wrong with the world such that such a travesty could gain common currency? Can't our innocent distractions at least rise to making a pretense of meaning something? Don't our cultural symbols deserve to have semantics deeper than mere empty tokens that can only be recognized, compared, and gawked at?

For the children.