R – Seeking Simply Scheme idioms for Dr. Scheme


I'm working my way through SICP, using both the Ableson/Sussman
lectures and the Berkeley 61A lectures, which are far more my
speed. I'd like to do some of the Berkeley homework, but need the
definitions for sentence, butfirst, butlast and so forth. It looks like at one time there was a simply scheme language built in to Dr. Scheme, but version 4.1.5, the most recent, doesn't have it. From Planet PLT
I thought I could simply add (require (planet "simply-scheme.ss" ("dyoo"
"simply-scheme" 1 0))) in my definitions window. I get

require: PLaneT
could not find the requested package: Server had no matching package:
No package matched the specified criteria

I tried grabbing the simply.scm file from here
and pasted it into my Dr Scheme definitions window, but it doesn't work:

In Advanced Student mode, I get
read: illegal use of "."

For the line (lambda (string . args) in the following code.

(define whoops
  (let ((string? string?)
    (string-append string-append)
    (error error)
    (cons cons)
    (map map)
    (apply apply))
    (define (error-printform x)
      (if (string? x)
      (string-append "\"" x "\"")
    (lambda (string . args)
      (apply error (cons string (map error-printform args))))))

In R5RS I get
set!: cannot mutate module-required identifier in: number->string
(line 7 of the following code)

(if (char=? #\+ (string-ref (number->string 1.0) 0))
    (let ((old-ns number->string)
      (char=? char=?)
      (string-ref string-ref)
      (substring substring)
      (string-length string-length))
      (set! number->string
        (lambda args
          (let ((result (apply old-ns args)))
        (if (char=? #\+ (string-ref result 0))
            (substring result 1 (string-length result))

Best Solution

Advanced Student will never really work for you unless you're following examples that were designed for it. Most books and examples will assume R5RS or something like it. I would recommend using the Pretty Big language, as that includes both R5RS, as well as the PLT require syntax, and a few other things.

In order to use the Simply Scheme package from PLaneT, you will need to use the new require syntax (you can find this on the package listing page; it looks like the docs for the package haven't been updated):

(require (planet dyoo/simply-scheme:1:2/simply-scheme))
Related Question