Round up of Little Schemer book club meeting seven?

16 views
Skip to first unread message

Joel Chippindale

unread,
May 21, 2014, 3:01:40 AM5/21/14
to computa...@googlegroups.com
Tom,

I was going to knock together a brief round up of meeting seven this morning but it doesn't look like you've pushed the commits we made to Github yet. Would you be able to push them?

J.

Joel Chippindale

unread,
Jun 2, 2014, 2:14:25 AM6/2/14
to computa...@googlegroups.com
7 of us met two weeks ago today for the 7th book club meeting and we made good progress.

We started by discussing whether we wanted to push on into Chapter 4 and implement numbers for our interpreter or to refactor some of the existing code and in particular List#evaluate which looked like it was becoming increasingly complex. This time we decided that refactoring was overdue and started work on this first and then moved on to Chapter 4.

@tomstuart drove the laptop and projector and together did some refactoring first

* We removed support for evaluating lists that start with lists (https://github.com/tomstuart/little_scheme/commit/d21a74483c13fdf27fc11a6bd17272aca56362d7) because this was not required by the book and supporting it was introducing extra complexity.

* We added a comment to the 'else' in the case statement in List#evaluate (https://github.com/tomstuart/little_scheme/commit/f13c934034eab4fde4127c37dff5ddf2b0e2426b) because we regularly need to explain to one another how this worked.

* We added the quote, lambda, cond, and or keywords to the environment (https://github.com/tomstuart/little_scheme/commit/7c7ca59120611aa4af4e40e49f2f8439ba9cb3f7 and https://github.com/tomstuart/little_scheme/commit/5a868b73b3921de97fd7545c93eb061dd67c57bb)which enabled us to replace the case statement in List#evaluate with our environment hash look up.

This highlighted the fact that our interpreter allows you to redefine these keywords whereas many scheme interpreters appear to have a separate spaces for variables and keywords i.e. in chicken scheme [1]

    #;1> (or (quote a) (quote b))
    a
    #;2> (define or (quote my-or))
    #;3> or
    my-or
    #;4> (or (quote a) (quote b))
    a
    #;5>

This made some of us feel uncomfortable about this implementation. The Little Schemer book does not suggest one approach or another and we didn't come to agreement on the reason why this might be the case in many scheme interpreters (i.e. is it just an implementation detail or specific language design and if so why).

Note: although we didn't try this out in the meeting, mit-scheme [2] works like our interpreter does in the sense that if you can redefine a keyword [3].


* We made Atom#== and List#== tolerant of other classes (https://github.com/tomstuart/little_scheme/commit/b7bc4e39b104c87a7ba29c0d292f77bdb3ba773a

* Which enabled us to make 'else' only have special meaning within a 'cond' rather than everywhere (https://github.com/tomstuart/little_scheme/commit/f1118a7f3d7e84d791e286819d3d023f42eddc0e)

* We added the primitives car, cdr, cons, null?, atom? and eq? to the environment (https://github.com/tomstuart/little_scheme/commit/16b2adbdd6c46127bd1e62d45df2476fa2866b05) to match our implementation of keywords.

This made our primitives much more explicit.

There was some discussion of how much this refactoring of List#evaluate (both putting keywords and primitives in the environment) had reduced complexity vs. just moving complexity about in the system.

* We renamed one of our #evaluate methods to #apply to make it clearer that they were different (https://github.com/tomstuart/little_scheme/commit/b30d97ad6991abb74884007bca892039128e4dfd)


Then on to chapter 4

* We started by adding the rspec examples for chapter 4 that @tomstuart had prepared earlier (https://github.com/tomstuart/little_scheme/commit/e063781f8e5895fb796c2afb36af217e1c03e177)

* Then after some(!) discussion of whether -3 constituted a number given the ambiguity in the Little Schemer book (it appears to be possible to read the book as saying it will not cover negative/non integer numbers or as saying that only non-negative integers are considered numbers) we agreed to delay the decision by pending and then skipping these specs (https://github.com/tomstuart/little_scheme/commit/5e6e2e0b424e8049f9c5087d84e023a0ddc94704 and https://github.com/tomstuart/little_scheme/commit/eb72da22f01479f8ba95219c3d516242cc39dc0f)



* We refactored Atom to ensure that its symbol was always a symbol (https://github.com/tomstuart/little_scheme/commit/f3d813e1fa56a5a2953656bb0839563236ebc570)


* We refactored to consolidate implementations of number? (https://github.com/tomstuart/little_scheme/commit/7769d165c87ae42957fb073a561e234ea87feba9)

* We updated 'sub1' so that it would fail rather than return a negative number (https://github.com/tomstuart/little_scheme/commit/538ce25d53d0d7b52bf8f6370a21dc7148ecbe10)


These meeting notes are a little later than usual and have just made it out in time for our next meeting which is tonight. See you there,

J.



Reply all
Reply to author
Forward
0 new messages