[plt-scheme] can't run SICP "generic operations" code in PLT Scheme 4.1

From: Fred G. Martin (fredm at cs.uml.edu)
Date: Wed Oct 15 19:21:21 EDT 2008

Hey, I rewrote the make-table routine using the hash procedures, and
it is definitely happier!  See below.

Thanks too for the pointer to that Version 4.x FAQ.  It is long, but
clearly discussing the critical issues in a concise fashion.  A big
help.

Fred

;SICP generic operations table re-written with hash
(define (make-table)
  (let ((local-table (make-hash)))
    (define (lookup key-1 key-2)
      (hash-ref local-table (list key-1 key-2) #f))
    (define (insert! key-1 key-2 value)
      (hash-set! local-table (list key-1 key-2) value)
      'ok)
    (define (dispatch m)
      (cond ((eq? m 'lookup-proc) lookup)
            ((eq? m 'insert-proc!) insert!)
            (else (error "Unknown operation -- TABLE" m))))
    dispatch))

(define operation-table (make-table))
(define get (operation-table 'lookup-proc))
(define put (operation-table 'insert-proc!))



On Wed, Oct 15, 2008 at 8:32 AM, Robby Findler <robby at cs.uchicago.edu> wrote:
> On Wed, Oct 15, 2008 at 7:23 AM, Matt Jadud <jadudm at gmail.com> wrote:
>> For Fred (and others coming to the PLT 4.x game late), the things that
>> took me by surprise yesterday:
>>
>> 1. Hash table operations have all had name changes.
>> A. Mutators are gone from structures. (define-struct foo (a b)) no
>> longer yields "set-foo-a!". Yes, they can be introduced at
>> definition-time, but not if they're being provided by a library.
>> "struct-copy", I think, was the functional way to update a structure.
>> (Apologies if I just got that wrong.)
>
> Yes, struct-copy (note that copy-struct is the old one).
>
>> 2. 'require' and 'provide' specifications have changed.
>
> Just in case you didn't find it yet, more along the lines of the above
> can be found in the plt distribution:
>
>  plt/doc/release-notes/mzscheme/MzScheme_4.txt
>
> The latest version of that file is here:
>
> http://svn.plt-scheme.org/plt/trunk/doc/release-notes/mzscheme/MzScheme_4.txt
>
> Robby
>


Posted on the users mailing list.