Decomposing the Ulam spiral

Frank Shearar wrote “The Ulam spiral is a well-known mystery to mathematicians: draw a 1 in a grid, 2 in the cell to the right, 3 above the 2, and so on in a spiral: 17 16 15 14 13 18 5 4 3 12 19 6 1 2 11 20 7 8 9 10 21 22 23…”

Intercession without source changes

Frank Shearar wrote “Methods in a Smalltalk object live in the method dictionary of its class. A method dictionary maps Symbols to CompiledMethods. From the virtual machine’s perspective, anything that understands #run:with:in is compatible with a CompiledMethod, in the sense that the VM sends this message to things that it will execute. As a result, it’s easy enough…”

Monticello -> Git

Frank Shearar wrote “Back in the dark years of 2003, Avi Bryant and Colin Putney tried to use CVS to version their Smalltalk code and failed dismally. They decided to scratch their itch, and Monticello was born, a DVCS centred around managing the structured text of Smalltalk code. Years have passed, and nowadays we have Mercurial and Git…”

Serving JSON at Altitude

Frank Shearar wrote “Colin Putney recently released a preview version of a new Smalltalk web framework, Altitude. Altitude seeks to be a RESTful Seaside: an HTTP framework that uses RESTful URLs, ubiquitous use of Xtreams, and learning the lessons of years of Seaside development. Let’s take it for a spin!”

Least fixed points, and the grouping of behaviours

Frank Shearar wrote “Sometimes one has a set of interrelated (monotonic) recursive equations one needs to solve. An naïve implementation will recurse infinitely. Handily there’s a solution: the least fixed point. I had need of one the other day, implementing parsing with derivatives. So why bother with least fixed points? Let’s find out…”

Resumable exceptions can macro-express delimited dynamic variables

Frank Shearar wrote “We already know that delimited continuations are more expressive than undelimited ones (call/cc). We can trivially express undelimited continuations by wrapping our entire program in a reset marker, while we need a mutable cell to express delimited continuations using call/cc. There’s another very handy construct in programming that uses the call stack: dynamic variables. We…”

Fun with Blocks

Frank Shearar wrote “We’ve already seen that Smalltalk has a very lightweight syntaxes for closures: [:x | x] for the identity function, for instance. We’ve seen them form an essential part of Smalltalk’s structure, allowing us to have all control structures part of the library rather than baked into the language. For what else might we use them?”

“Duck-finding” for testing your Theories

Frank Shearar wrote “A while ago I wrote a semi-port of Haskell’s QuickCheck. Easy enough – a property is like a test method but with arity 1, into which you inject data – potential counterexamples to your theory. In Haskell, the type system can, through unification, figure out the type of the generator required for that property. What…”

Unifying parts of structures

Frank Shearar wrote “Those with even a passing familiarity with Prolog should recognise statements like [H|T] = [1,2,3]. In particular, = here is not “is equal to” but rather “unifies with”. So that statement causes the variable H to unify with 1, and T with the rest of the list, [2, 3]. Clojure’s abstract bindings provide much the…”

Translating a persistent union-find from ML to Smalltalk

Frank Shearar wrote “When I wrote my unification library a while back, I tried to add an “or matcher”. That is, something that would allow | matcher mgu | matcher := OrUnifier     left: (TreeNode left: #x asVariable)     right: (TreeNode right: #x asVariable). mgu := matcher =? (TreeNode left: (Leaf value: 1)). mgu at: (#x…”

Clojure to Smalltalk translation notes

Frank Shearar wrote “Clojure has an interesting implementation of a Huet-style zipper. I started translating it to Smalltalk, and in the process discovered a number of things not really related to zippers. Given that the end result ends up looking very similar to something we’ve already seen , let’s talk more about the translation process itself.”

Checking Squeak Quickly

Frank Shearar wrote “The good fellows in Haskell land came up with a nice idea one day: instead of relying on a programmer writing well-thought out tests, with test data designed to flush out edge cases, they realised that people aren’t very good at finding bugs in their own code. The real world is too random, too crazy,…”