2 minute read

Daily dispatches from my 12 weeks at the Recurse Center in Summer 2023

Today I have this to show for myself:

In Creative Coding my group was working on generating weird fractals in response to the day’s prompt about organic machines. Meanwhile I got sucked into seeing if I could bounce this rectangle around since it was my first time playing with p5.js. You’re welcome.

The full clip on YouTube

Going to keep it short today since I’m eager to continue doing things with Lisp. Although, I suppose I’ll share a problem I encountered, which is this:

Suppose you have the following Scheme code:

(define (p) (p))

(define (test x y)
  (if (= x 0)

(test 0 (p))

The question is: What behaviour would we expect if the interpreter is using applicative-order evaluation (like Lisp) vs. normal order evaluation (like…something else)?

With applicative-order evaluation, the expressions are recursively expanded first. That means when we call test with arguments 0 and (p), the expression (p) will be evaluated first. This is where I got stuck: When you call the function (or I guess “procedures” as SICP prefers), what the hell is going on? The Lisp syntax was throwing me off. It seems like we are defining a procedure p with no parameters, and the body of this procedure does nothing but recursively call itself. Infinitely. Which, it turns out, is correct: When the expression (test 0 (p)) is evaluated in an applicative order, (p) is expanded first – infinitely – thus… well, actually, I’m not sure. I’m assuming the interpreter would throw an error if there’s a maximum recursion limit. But the point is that the procedure test will never actually be called.

Not so in a normal-order evaluation, where the expression (test 0 (p)) will pass 0 and (p) as arguments to the procedure (the latter still not having been expanded), and when (= x 0) evaluates to true, the procedure will happily return 0 without ever needing to expand the second, fatal argument.

Not a particularly difficult problem. Where I got stuck was the unfamiliar Lisp syntax in the recursive function, which I thought I might have been interpreting incorrectly. The Python equivalent might be something like this:

def my_func():

Here’s what else you need to know today:

  • Checkins
  • Met with another humanist-turned-coder, talked about data trajectories, mused about studying stats, got some more valuable GitHub hand-holding
  • Creative Coding (fractals and DVD logo and p5.js)
  • Nand2tetris, where I successfully reeled in one and maybe three folks to join me from the beginning and demo’ed the first week’s projects