Sep. 14th, 2015

elfs: (Default)

One other thing about Lisp in Small Pieces chapter 5 jumps out at me: the storage story.


In the interpreter written for Chapter 5, some things are cons lists (most notably, the expression object you pass into the interpreter), and some things are lists, but they’re not built with car/cdr/cons.


In chapter 3, we built an interpreter that used full-blown objects, in which each object had a field named “other” that pointed to the next object; when looking up a variable or an unwind point, the search was an explict call: starting with the latest object, a search would begin down the chain for a match and, when found, would trigger either a memory retrieval or a continuation, at which point the interpreter would resume with the relevant memory or continuation. Each object had a “failure” root class that would throw an exception.


In chapter 5, it gets even more functional. Chapter 5 tried to define everything in the Lambda Calculus, which allows for closures, but doesn’t by default support objects. But Quiennec really wanted to teach about allocation issues, especially the boxing and unboxing of values, so to make that point, he created two structures: one represents variable names that points to indexes, and one represents an indexed collection of boxes. Lookup represents the Greek equation σ (ρ ν), which is basically that the environment knows the names of thing, and the store knows the location of things.


But in order to be explicitly literal, Quiennec goes full-on. Both environment and store are represented the same. He creates a base environment that looks like this:


ρ.init = (ν) -> "Variable name not found."

and then when we add a new variable name to the stack, we write:


(ρ, ν, σ, κ) -> (ν2) -> if (ν2 == ν) then κ(σ) else ρ(ν2)

. In this case, we call a function that creates a function that, in turn, says “If the name requested matches the name at creation time, return the stored store point (actually, continue with it), else call the next (deeper) environment, all the way down the stack until you find the thing or hit ρ.init”.


It’s a really cheesy ways of emphasizing that you can do Lisp in a full-on Lambda Calculus way, but you probably shouldn’t. It’s also completely dependent upon the parent environment to reap memory when you’ve examined the tip of an expression and have retreated back toward the base of the expression tree to proceed down the next expression.


Lessons here are about the Lambda Calculus, and about memory management. In the latter case, how hard it’s going to be if you want to do it the way the big boys do.  Garbage collection is hard.

elfs: (Default)
I played the Id game Rage this weekend. I'd found it in a remainder bin, and I vaguely remember having played and enjoyed it, so I figured another play-through would be fun. I also purchased the add-ons "Sewers" and "Scorchers," the latter of which is an entire major in-game campaign that unlocks after you reach the Wellspring level.

The Scorcher campaign starts in caves under Dan Haggar's compound. Which is weird because Dan never mentioned caves and there's really no association between those caves and the placement of the Haggar settlement; there's no benefit there. The number one need of people in the wasteland is water, and if the caves are sources of Dan's water, they should bloody well say so. (That said, we know there's a lot of water bubbling through the crumbling dam area just to the west, so why loser clans like the Ghost and Wasted are allowed to monopolize it is inexplicable.)

And that's where you meet Sarah Haggar. So far, in Rage, you've met a couple of women: Janus, Loosum, Becky, Olive, Sally, Elizabeth, Ginny, and Daemia. All of them were dressed appropriately for their environment. Ginny and Loosum wear cargo shorts, but so do some of the men.

Sarah Hagar is dressed in a ragged knee-length skirt and a two-toned hand-stiched leather bikini top. She wears this while actively in combat against mutants and Scorcher bandits deep in a cave of sharp rocks and dangerous tools.

This makes absolutely no sense. You've already bought at least two upgrades for your body armor, and she's dressed like a character from Dead Or Alive. It's weird how this annoyed me. Rage had been doing so well with its women characters up to this point.

Totally by coincidence, Feminist Frequency this morning puts up an article about Buying Women's Bodies Through DLCs. But in her point, she talks about how this is used as a selling point; access to visible representations of pliable women is used to upsell the product. The sexism sells. But as far as I can tell, Sarah's appearance was never used to sell the Scorchers DLC. It's just... there. Unnecessarily. Which makes it all the stranger.
elfs: (Default)
I really have to get back into meditation. It's been too long, and while I've been able to keep up the workout and yoga, meditation has fallen by the wayside. Which is a pity because I've recently read a fascinating meta-study on the kinds of meditation. It seems there are five kinds of meditation, and when I remember to practice them, I've only been practicing two of them.

There is attentional meditation, in which the attention is brought back to a single point. Open-monitoring attentional meditation is Zazen, the most common of Zen practices, and involves not concentrating on any single thing, but maintaining a specific state of mind, a state in which awareness of metacognitive states is paramount, and maintaining that state is the point of the practice. And it is practice, and it takes effort.

On the other hand, there's cultivation of attention, which is expanding one's power to concentrate on a single subject with power. In the Greek and Roman traditions, this is pneuma, and is the practice most recommended by the Stoics. It's a difficult practice, and it involves expanding one's power to accomplish one's goals without invoking burnout.

These attentional meditations exist to strengthen your own self-awareness, and to help you regulate your reactions to events. It's not meant to suppress emotions, but instead to help you cultivate the best emotions, the most joyous emotions.

Stoicism also has a values meditation, called the premeditatio malorum, in which you think about how you will react if something horrible happens-- the house burns down, a family member dies, you lose a limb, or worse. The idea is to both concentrate the mind on enjoying what you have now, and telling others how much you appreciate them, and planning in the theater of the mind for how to react most effectively to disaster, such that you can regain equilibrium quickly.

Theravadan loving-kindness meditation (the kind practiced by the Dalai Lama) is surprisingly enough in the same family of values meditations. These are considered constructive meditations, in that your role is to contemplate how you fit into the world, and how best to help those around you. Both have the same basic premise, though: "You were not put on this Earth to procrastinate."

The last is deconstructive. The purpose of this, which often happens as a side-effect of attentional meditations as well, is to help you understand how your own mind works. Dzogchen's been getting a lot of attention recently, and it's main purpose is to emphasize the Buddhist insight that there is no "I" in each of us, no little man inside our head who is "me" in a concrete, atomic sense; you are a mass of impulses, emotions, moods, biochemistries, and sensations, all vaguely moving in the same direction.

There's a lot more to say about this paper. But I'll leave it at this for now.

Profile

elfs: (Default)
Elf Sternberg

February 2026

S M T W T F S
1234567
891011121314
151617181920 21
22232425262728

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 9th, 2026 07:59 pm
Powered by Dreamwidth Studios