Ward suggested that Thompson join him and metaphorically Rake in the Field of computer programming.
>To be native to a place we must learn to speak its language -- Robin Wall Kimmerer
I talked him through opening the javascript editor on the very page we were using to video chat. cmd-option-i does this for Chrome on a Mac.
I suggest things to type into the console command line.
5 5
2+3 5
x=2+3 5
x 5
y="five" "five"
y.length 4
We have created some numbers and strings which we save in variables. Strings have a length, a property of string objects.
z=[x,y] 2
z (2) [5, "five"]
z[1] "five"
z[0] 5
z[2] undefined
We have created an array that holds the values we had stored in x and y. The array becomes the value of z.
z.length 2
z.push(3.14) 3
z.length 3
z (3) [5, "five", 3.14]
Arrays have a property length, a number, and property push, a function, that modifies the array. Function joins number, string and array as basic types.
z.push(z) 4
z (4) [5, "five", 3.14, Array(4)]
z[3] (4) [5, "five", 3.14, Array(4)]
We push the array onto the end of itself. What does this even mean? Javascript makes sense of this and Chrome handles printing it without looping infinitely.
z.push(Math.PI) 5
z (5) [5, "five", 3.14, Array(5), 3.141592653589793]
We push a more accurate pi onto the array to make five elements. We see from this print that the array within the array has grown to five elements too because it is the same array.
# Reflection
What did we expect to come from this brief tour into javascript programming? We will explore this episode in five parts.
intention exploring evidence this is interesting... what does it mean?
# Ward
I wanted to expose Thompson to programming at pretty much the same level Alan Kay spoke to kids. Alan and I both feel the power in the Abstraction and want to share it.
Javascript and the browser are both descendents of Smalltalk in a way that will be useful when exploring object-oriented computation. We will try things. I'll suggest things with the strongest resemblance to the roots.
Javascript stores objects in the browser's memory and can evaluate expressions which the browser then prints. Everything we type is a Question. Every print an answer. The specific answers suggest how javascript and the browser work. We found that z[3] was "undefined" but not otherwise an error. We found that an array can hold itself and that this doesn't confuse the browser's print routine.
I wasn't sure I could lead a tour that would be both short and meaningful. I became more engaged as we progressed. My wife, half listening, laughed with horror when I suggested pushing x into x. Now we both need to know, what would happen.
The computer is a machine made out of small simple parts. It is only complicated because there are billions of them. There are a few hundred kinds of parts and a few dozen ways of making each. This is still a lot to know but it is knowable. People know it.
# Thompson
I am a curious learner about learning. I see myself as an experiment. Perhaps, in my explorations, I might stumble upon insights that illuminate a greater meaning. It was with that curiosity that I first started writing in the wiki.
But now Ward is leading me into another journey. One where I have an 'everyman' fear when in the audience of code wizards. There is much to understand and little that is immediately obvious. Having spent years around developers, I have known how to nod knowingly without knowing.
I first learned to code in the simplest way when I was in middle school. We had a terminal that connected to a computer at a nearby college – a timeshare arrangement. I learned to type into a terminal that punched a tape holding a simple program that would then be read back in to be run. But I was not curious enough to continue my explorations.
I was curious again when PCs were first introduced in the earlier eighties. Enough so that I learned to program a time management system for a design company that I was working at as a photographer. My thinking became obsessive and I once again walked away.
That was over thirty years ago. Most has been lost, much like my paltry Chinese. Forgotten unlearned languages.
But now I am curious about learning how understanding emerges that empowers creativity – these inference networks known as Markov Blankets.
Parent, child and child's parents forming increasing complex meaning matrices in our schema.
So we begin: 2+3=5.
We find ourselves quickly led to an unexpected philosophical question: what might it mean for an array, an object, to hold itself as a fractal expression? At least the browser didn't crash.
Curiosity: another experiment.
# Recursion
We made this first programming experience interesting by inserting a self-reference into an array. Similarly philosophers notice circular arguments quickly while amateurs might go around the loop many times and quit only when they get tired. We might ask, when and how do programers break the loop in computations compared to other disciplines?
Mathematics is more careful but not immune to destructive self-reference. Kurt Gödel famously showed that arithmetic cannot be completely axiomatically defined due to a variation of self-reference in the axioms.
Computation deals routinely with self-reference by representing values with memory addresses of the values. The hitch comes from algorithms that blindly follow these pointers endlessly. Thus one must "break the recursion" with some sort of additional check. Here we saw the print routine choose between two possible print representation of an array: [ ... ] or Array(size).
Hypertext avoids most risks of self-reference by following links only one step at a time. We somewhat humorously describe the 99 Bottles of Beer song with self-reference on Seventh Floor of a learning game. There is no break so one can keep playing until negative numbers appear.