Skip to main content

Big O(Weird)

#!/usr/bin/env python
steps = 0


def f(x):
    global steps
    for i in range(x * x | 42, x | 42, -42):
        steps += 1
        yield i


def g(y):
    global steps
    z1 = f(y)
    z2 = f(y*y)
    z1l = [z for z in z1]
    steps += len(z1l)
    xyz = 0
    for z1, z2 in zip(z1l, z2):
        steps += 1
        if z1 == z2:
            pass
        xyz += (z1 + z2)
    return xyz


def h(z):
    global steps
    tots = 0
    for i in range(z):
        steps += 1
        if not i % 3:
            tots += g(i)
        elif not i % 2:
            tots += sum(f(i))
        else:
            pass
    return tots


print(h(1))
print(steps)

print(h(10))
print(steps)

print(h(100))
print(steps)

print(h(1000))
print(steps)

Better Left Unsaid

Saying something is “better left unsaid” implies distaste - that the thought behind the words was inappropriate, and self-moderation would be wise.

I offer you an alternative meaning - considering what or what not to say is not inherently self-censorship. Instead, it is expressive power.

Read more…

The Good Kind of Scarcity

There has been much ado about web3, “crypto”, and decentralization lately. I care about, study, and work with the web, decentralization, and even a touch of cryptography - but I think that recent trends hinge less on technological specifics and more on economics, human behavior, and scarcity (or lack thereof).

Technology obviates scarcity, and computational technology especially so. Price is driven by supply and demand, with effectively infinite supply making price negligible. This makes the marginal cost of digital goods generally near zero, with the barrier to create and share content lower than ever.

The result is a world that gives consumers unprecedented media options, and at the same time makes it challenging to compensate artists. The blockchain enables a form of (artificial) scarcity, with NFTs digitally embodying assets, which some argue can address the above challenges. To form opinions on manufactured scarcity like NFTs, I think it is useful to more generally consider what is good about scarcity and what is not so good, economically and beyond.

Read more…

Contextual Clams

There’s no wrong notes in jazz.”

You’ve likely heard this sort of claim from jazz enthusiasts. “It’s jazz!” is a justification for apparent discordance and free rhythms, “playing outside” the established changes and structure of the song.

There is a truth underlying this belief - but as with most things, the full story is more nuanced. Wrong notes exist in jazz, and even have their own slang term - clam.

Read more…

Notes as Closure

I take a lot of notes.

I do so rather haphazardly - sometimes I write things down in a text file. Sometimes they end up in an email draft, or a message sent to myself. Sometimes they’re in a proper document of some sort, a markup language or wiki or website.

I make notes about a lot of things - things I want to read, things I find clever or interesting, things I should research more in future. I write down stuff to make or to get and inventorize stuff I have or have done already.

Read more…

Qualitative Data” is Experience

Being “data-driven” is a common refrain - often followed by an insistence that people consider both “quantitative” and “qualitative” data. The subtext is that, on their lonesome, numbers are incomplete, and possibly cold and insensitive. Human intuition, and compassion, is necessary to supplement dry quantitative analysis.

Logic is, in fact, incomplete - though not really in the way most people think. And the human perspective is integral to many decisions (as they impact humans) and should not be neglected.

But the best way to balance “quantitative” data (henceforth simply data) and human needs and perspectives isn’t to conflate the two. Doing so dilutes numerical explanations while skewing opinion, leading to an overconfident “data-driven” rationalization of what is actually a distorted analysis.

Data (in the modern “data science” sense of the term) is a series of observations, consistently recorded facts and information. It is inherently quantitative (even if it is categorical, messy, or unstructured), as each observation can be enumerated, and on that basis some form of statistics can be calculated (at least counts, aka quantities, for unstructured data - and that’s before applying whatever clever techniques to engineer proper features).

Qualitative information (N.B. not data) is about qualia - a concept even fuzzier than NLP and unstructured data. You can (and should!) dive into the sundry academic perspectives, but for a pithy contemporary take:

Tragedy is when I cut my finger. Comedy is when you fall into an open sewer and die.” - Mel Brooks

Read more…

Codebases are Amortized Intelligence

Anyone who has written more than a handful of lines of code gains the intuition that measuring productivity in terms of code quantity is not a promising approach. But the perception that a codebase is an asset - whether proprietary or otherwise - is present even in engineering cultures.

How do we explain that having code is worth something, but measuring work in terms of writing it isn’t? One answer is that lines of code are valuable, but in such a nonlinear and context-sensitive way that counting and assigning some sort of score is futile.

I find that perspective compelling - but incomplete. To understand why code is valuable we have to first ask what a codebase really is.

Read more…

Profit from Effort

A continuation of Profit as a Series of Asymmetries.

When one party is monetarily compensated by another due to their hard work, that is capitalism “working as intended.”

Work reduces not just to capitalism, but to physics - it is the energy transferred by applying force to effect displacement. In other words, it’s pushing stuff around, and when considered figuratively it is an apt description for many capitalistic enterprises.

Read more…

Monad Lisa

#!/usr/bin/env python


class MonadLisa:
    """A Monad-ish structure containing the Mona Lisa."""

    def __init__(self, func):
        """Set Mona Lisa inner state, execute function."""

        self._mona = """
            ____
            o8%8888,
        o88%8888888.
        8'-    -:8888b
        8'         8888
        d8.-=. ,==-.:888b
        >8 `~` :`~' d8888
        88         ,88888
        88b. `-~  ':88888
        888b  --' .:88888
        88888o--:':::8888
        `88888| :::' 8888b
        8888^^'       8888b
    d888           ,%888b.
    d88%            %%%8--'-.
    /88:.__ ,       _%-' ---  -
        '''::===..-'   =  --.  `
        """
        self.error = None
        self.result = None
        self._run(func)

    def _run(self, func):
        """Run function on inner state, set result or error."""
        try:
            self.result = func(self._mona)
        except Exception as e:
            self.error = e


def run_examples():
    """Examples of the MonadLisa class."""
    print("Monad Lisa examples")
    print("Each run instantiates a MonadLisa")
    print("and gives it a different function")

    print("\nm1 is the built-in 'print', causing below side effect")
    m1 = MonadLisa(print)
    print("m1 error:", m1.error)
    print("m1 result:", m1.result)

    print("\nm2 is the identity function")
    m2 = MonadLisa(lambda x: x)
    print("m2 error:", m2.error)
    print("m2 result:", m2.result)

    print("\nm3 is the built-in 'abs'")
    m3 = MonadLisa(abs)
    print("m3 error:", m3.error)
    print("m3 result:", m3.result)

run_examples()

Thoughtless Niceness

In erstwhile eras, when “corona” referred to astronomical halos and terrestrial beverages, certain behavior was, in some circles, considered nice. Small talk in grocery stores, Girl Scout cookies sold door-to-door, surprise birthday parties - all assorted opportunities for spontaneous social interaction.

The (apparent) intent of these events was always benevolent - and many participants derived as genuine of joy as most of us can claim to. The sudden shift to pandemic life was particularly challenging for those whose identity centered on communal engagement - but it also offered an opportunity for an unprecedented introspection into what we do and why.

Read more…