[racket] list of Racket <-> Scheme R5RS differences?

From: John Clements (clements at brinckerhoff.org)
Date: Tue Oct 25 15:38:55 EDT 2011

On Oct 25, 2011, at 11:52 AM, Dan Grossman wrote:

> Hi all,
> I'm wondering if there's a concise, informal, mostly complete list of
> R5RSisms that won't work in Racket (#lang racket).  As I'm porting
> some old teaching materials to Racket, I've come across:
> * Cannot write (if e1 e2); replace with (when e1 e2) or (and e1 e2)
> * Cannot write (); replace with null or '()
> * Cannot write set-car! or set-cdr!
> To be clear, I like all these changes, it would just be great to have
> a check-list of things to look for.
> Honestly, what would most help /me/ personally would be a list
> comparing to "Pretty Big" from May 2008, but since that would
> presumably help fewer people, R5RS seems like a better starting point.
> I can probably figure out other non-R5RS changes relevant to me, such
> as struct being preferred to define-struct and significant changes to
> the module system.
> And notice I'm not asking for things Racket has /added/ -- that list
> would be long and is well covered by reading the documentation.

Is there an R5RS test suite lying around? This would seem to be a relatively efficient way to compute such a list.

Okay, Hmm... There's a "corner cases" test that I found, wherein Racket differs (according to the test suite) from R5RS in the semantics of letrec (I've attached these tests below). There's also a monster 62,000 line test suite called s7test.scm that is a test of a scheme implementation called s7, apparently derived from a whole bunch of other tests living in other places.  I spent 10 minutes shuffling through the lexical differences before running out of steam.

So! Here's my incomplete list; anyone that wants can add to it; I'm guessing that the list would be an extremely long one....

In module context:

- re-definition of identifier not allowed
- if must have else
- semantics of letrec arguably non-standard
- many reader extensions (#| comment style, two infix dots)
- set-car! and set-cdr! replaced by set-mcar! and set-mcdr!

;;Credits to Al Petrofsky
;; In thread:
;; defines in letrec body 
;; http://groups.google.com/groups?selm=87bsoq0wfk.fsf%40app.dial.idiom.com
(should-be 1.1 0
 (let ((cont #f))
   (letrec ((x (call-with-current-continuation (lambda (c) (set! cont c) 0)))
            (y (call-with-current-continuation (lambda (c) (set! cont c) 0))))
     (if cont
         (let ((c cont))
           (set! cont #f)
           (set! x 1)
           (set! y 1)
           (c 0))
         (+ x y)))))

;;Credits to Al Petrofsky
;; In thread:
;; Widespread bug (arguably) in letrec when an initializer returns twice
;; http://groups.google.com/groups?selm=87d793aacz.fsf_-_%40app.dial.idiom.com
(should-be 1.2 #t
  (letrec ((x (call/cc list)) (y (call/cc list)))
    (cond ((procedure? x) (x (pair? y)))
	  ((procedure? y) (y (pair? x))))
    (let ((x (car x)) (y (car y)))
      (and (call/cc x) (call/cc y) (call/cc x)))))

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20111025/e07246ea/attachment.p7s>

Posted on the users mailing list.