It was the sixth meeting of the Little Schemer book club last night, and seven of us showed up.
We began by recapping the events of the previous meeting for those who had missed it: we now had a basic implementation of `lambda`, allowing most of the chapter two examples to pass, but the code was a little messy and our implementation only supported defining & calling functions of a single argument.
Then we discussed what we wanted to do in this meeting: clean up the existing code, or press on to the end of the chapter? Several of the outstanding failures were caused by our interpreter's lack of support for `or`, which seemed simple enough to fix, so we succumbed to temptation and dug into getting all the examples to pass before we did any refactoring.
@joelchippindale drove the laptop & projector, and together we worked through the remaining failures:
* We added support for evaluating `or` (https://github.com/tomstuart/little_scheme/commit/c054cf3
); there was some discussion of how best to do this (could we implement it in Scheme, since chapter two doesn't seem to care about whether it short-circuits? could we rewrite it to an equivalent `cond` and evaluate that?), but we ended up following the book by just adding it as another keyword and implementing it directly
* We changed our Lambda class to support multiple parameters in principle (https://github.com/tomstuart/little_scheme/commit/63523ee
), and fixed up all the places where we construct & evaluate lambdas to provide their single parameter/argument in the new way so that everything kept working
* Once that was done, we went back to the lambda construction & evaluation points and added support for multiple arguments (https://github.com/tomstuart/little_scheme/commit/d79cebc
At this point all of the chapter two examples passed, and there was much rejoicing. Again we paused to discuss whether we should press on to chapter three, or stick at the end of chapter two and refactor the code for clarity; again curiosity got the better of us, and we cherry-picked the chapter three examples (https://github.com/tomstuart/little_scheme/commit/05547fa
) just to see how much work would be involved in getting them to pass.
We were surprised to discover that all of them passed first time. It turns out that chapter three is dedicated to explaining more ideas about how to write recursive functions, but doesn't require any new language features, so everything just works.
Some of us were taken aback by this sudden spurt of progress, so we spent the remainder of the meeting actually behaving like a book club, reading through some of the Scheme programs in the chapter and trying to reconstruct them from scratch. We mostly convinced ourselves that we understood roughly what was being taught in this chapter, although some of us resolved to study it further at our leisure.
At this point we were feeling the irresistible draw of the pub, so we wrapped things up. In the next meeting we'll once again need to decide whether to soldier onward to chapter four (which is about numbers, so we'll definitely need to implement some new language features) or stick at our current level of functionality and refactor the interpreter. Either way, this would be a good time for everyone to read up to the end of chapter four, so that we're all prepared for what may come next.
This was one of the most exciting meetings so far, and certainly the one in which we made the most progress through the book, suggesting that perhaps our velocity will increase now that we've got the basics down. Thanks to everyone who came — can't wait for the next one!