[plt-scheme] Bridging the gap: Language needed

From: Gary Baumgartner (gfb at cs.toronto.edu)
Date: Thu Mar 19 15:26:54 EDT 2009

One person already asked in private for help running the code.
 It needs language "Pretty Big".

I have to update myself on R6RS, DrScheme 4.X module and #lang stuff.
 Until then, I'll mention more for ambtious readers who might read it:

  (define (?) (error "No."))

  (define-syntax -<
    (syntax-rules ()
      ((-<) (?))
      ((-< <e0> . <es>)
       (let ((old-fail ?))
         (let/cc resatisfy
           (set! ? (lambda () (set! ? old-fail) (resatisfy (-< . <es>))))

The error procedure is not R5RS standard.
It's used here to abort somewhat cleanly to the Interactions pane (REPL)
 when there are no more branches. You could explore display:

  (define (?) (display "No."))

Also, saved versions of it are called old-fail because originally ? was called fail.
 In other words, they are "fail this branch and try next branch", but except
 for some Prolog students people liked "?" better, as a kind of "next?".

let/cc is a common non-R5RS syntax:

  (define-syntax let/cc
    (syntax-rules ()
      ((let/cc <continuation-name> . <body>)
       (call-with-current-continuation (lambda (<continuation-name>) . <body>)))))

And apparently I'm not supposed to be using set! on (just?) top-level define'd names.

Posted on the users mailing list.