# On Smalltalk, Joe Armstrong

## On Smalltalk

I started messing about with Pharo last night [1], figuring that I could start by implementing some of the stuff for PIM [2]. I have all of three methods done; new that sets up the coefficient list, and degree and evaluate. It took a while to get evaluate working because I had to figure out how to collect into a list. It's a but ugly but

```evaluate: x
"Evaluate the polynomial at the given points."

^ ((1 to: (a size)) collect: [ :i | (a at: i) * (x raisedTo: i - 1) ]) sum.
```

is what I came up with. An obligatory quick demo:

```"One of the simplest examples: p(x) = x."
p := RealPolynomial new withCoefficients: #(0 1). "a RealPolynomial"
p degree. "1"
p evaluate: 2. "2"
p evaluate: 3. "3"

"Slightly more complex example: p(x) = 2x^2 + 3x - 4."
p := RealPolynomial new withCoefficients: #(-4 3 2). "a RealPolynomial"
p degree. "2"
p evaluate: 2. "10" "(-4 + 3 * 2 + 2 * 2^2) -> (-4 + 6 + 8) -> -4 + 14"
p evaluate: 3. "23"

"Let's get crazy. p(x) = 6x - 2x^2 - 9x^3 + 2x^4 + 6x^5 - 10x^6."
p := RealPolynomial new withCoefficients: #(0 6 -2 -9 2 6 -10). "a RealPolynomial"
p degree. "6"
p evaluate: 2. "642"
p evaluate: 3. "5754"

"The zero plynomial is constructed by default."
z := RealPolynomial new. "a RealPolynomial"
z degree. "-1"
```

## On Joe Armstrong

So Joe Armstrong passed away. He was a true legend of computer science; just the other day I reformatted and imported the forgotten ideas in computer science here that got me rethinking about so many things; I ended up starting the Code Mesh video where Joe interviews Alan Kay and it's bringing up a lot of interesting things and I guess that's what I associate Joe with: an interesting future borne from an interesting past, not just a pop culture. I once saw Joe talk at a local meetup [3], and he was talking about his universal function store idea [4], and I watched him implement RSA in Erlang. His talk abstract was typical:

Talk Abstract: This talk has three themes, Having fun, making money and making the world a better place.

In the having fun part I'll do some live coding so please bring a prime number with you. If you don't have a prime number you can buy one from me for a nominal donation to charity.

In the boring part of the lecture I'll talk about how to make money from Erlang (just do what the WhatApp guys did).

In the serious part I'll talk about what we have to do to make the world a better place.

Every time I'd see a post by Joe or a talk, I'd watch it and enjoy the joy, thoughtfulness, and playfulness he brought to the subject - you could do real, big things and have fun doing it.

## Other stuff

I reinstalled Debian on the netbook after failed attempts at installing OmniOS, OpenBSD, and NetBSD; after git cloning the repo for this site on a clean install, I realised that I'd made a mistake in the Makefile:

```-PIP ?= \$(shell command -v pip3 | command -v pip3.7)
+PIP ?= \$(shell command -v pip3 || command -v pip3.7)
```

One character makes all the difference.

## Notable quotes

 [1] I think I like the Pharo environment a little better than Squeak.
 [2] The Programmer's Introduction to Mathematics
 [3] I looked it up in my email. It was the 2014 September 25th ErLounge SF/Bay meetup, titled "Joe Armstrong, co-inventor of Erlang on Erlang for fun, profit and world peace!" I wish I had taken notes.
 [4] I think he called it a universal server?

Tags: