Sep. 15th, 2015

elfs: (Default)
I've spoken often of my love for *Illuminatus!*, the book that I discovered at 13 that made me realize life was worth living, if only because life was ridiculous and therefore not too worthy of angsting over. One of the best lessons from that book is Korzybski's "The Map Is Not The Territory." Robert Anton Wilson (pbuh) taught us all just how true that was with examples that, while silly, were also so plausible that they couldn't help but illuminate.

It's also possible to confuse the *mapper* with the territory. In many styles of meditation, what we seek is to understand how we shape the world, how the world shapes us, and to pick and choose from the many possible shifting shapes we may adopt to better fit the world around us. When we succumb to fatalism, when we insist there's no changing "fate's design," we are confusing the territory with ourselves.

Meditation taxonomy calls this "experiential fusion." The purpose of many meditations, some explicitly but almost all of them implicitly, is to separate the map-*maker* from the territory, to make us aware that we are not mere subjects of nature but agents in our own right, agents within our own skin, able to pre-decide how we'll react to stresses and disasters.

It is also okay to allow this fusion at times. Watching a movie or reading a book, it's acceptable to let this fusion happen, to become one with the storytelling, to feel it deeply. We've developed incredible cognitive vocabularies for maintaining a sense of self and other while deeply identifying with others, and learning this is part of the basis of compassion-based meditations. Strengthening that reflex, however, in a conscious and vital way, is as important as strengthening one's muscles and bones for the long haul that is life.

When we separate who we are from the world enough to make choices, then we start to exercise the only real form of free will we actually possess.
elfs: (Default)

I won’t reveal where or when I got this question, but it always amused me.  At the time, I answered it using Underscore and Coffeescript, which the interviewers allowed I was going to have access to… but here’s a pure ES6 solution.


The problem, simply stated, was “write a function that sums two polynomial equations and prints the results.”  They defined the format for the input this way:


// 5x^4 + 4x^2 + 7 
// 3x^2 + 9x - 7
var e1 = [{x: 4, c: 5}, {x: 2, c: 4}, {x: 0, c: 7}];
var e2 = [{x: 2, c: 3}, {x: 1, c: 9}, {x: 0, c: -7}];

They were kind enough to let me code on my keyboard.  My answer is rather dramatic.


// Reduce any list of equations into an array of maps of exponent:coefficient
var eqns = [e1, e2].map((a) => a.reduce((m, t) => { m[t.x] = t.c; return m; }, new Object(null)));

// Find the largest exponent among all the equations
var maxe = Math.max.apply(null, eqns.map((a) => Math.max.apply(null, Object.keys(a))));

// For the range (maxe ... 0), for all equations, sum all the coefficients of that exponent, 
// filter out the zeros, sort highest to lowest, create string representations, and print.
console.log(
        Array.from(new Array(maxe + 1), (x,i) => i)
        .map((exp) => [exp, eqns.reduce(((memo, eqn) => memo + (eqn.hasOwnProperty(exp) ? eqn[exp] : 0)), 0)])
        .filter((e) => e[1] != 0)
        .sort((e) => e[0])
        .map((e) => e[1] + (e[0] > 1 ? 'x^' + e[0] : (e[0] == 1 ? 'x' : '')))
        .join(' + '));

The interviewer just stared at it, and stared at it, and said, “I’ve never seen anyone solve that in three lines.  Or that fast.”


I shrugged.  “It’s a straightforward map/reduce of the relationship between exponents and coefficients, removing any factors that had a coefficient of zero.  This seemed the least buggy way to do it.  The riskiest part of this equation is the mapping back to string representation.  The nice feature of this function is that if we generalize the first line over an arguments array, it works for any number of equations, not just two.”


He agreed.  They ultimately didn’t hire me.  I had a friend there, and he said, “They really liked you, but it was pretty clear you were already bored where you were and moving from one infrastructure job to another wasn’t going to change that.”  Sad but true.


 

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. 11th, 2026 02:42 pm
Powered by Dreamwidth Studios