[r6rs-discuss] [Formal] Allow compilers to reject obvious violations

From: Abdulaziz Ghuloum <aghuloum>
Date: Wed Feb 28 00:22:57 2007

On Feb 27, 2007, at 11:19 PM, Robby Findler wrote:

>
> But how can we puzzle that out -- parameterize isn't in r6. Can you
> rewrite that with with-exception-handler ?

This takes the fun out of it. Oh well, here is an approximation:

(define (fact n)
   (define result 1)
   (define what #f)
   (call/cc
     (lambda (k)
       (with-exception-handler
         (lambda (_)
            (when (= n 0) (k result))
            (set! result (* result n))
            (set! n (- n 1))
            (what))
         (lambda ()
           (let f ()
             (call/cc
               (lambda (k)
                 (set! what k)
                 (car what)))
             (f)))))))

Aziz,,,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.r6rs.org/pipermail/r6rs-discuss/attachments/20070228/f05c38f4/attachment.html
Received on Wed Feb 28 2007 - 00:22:28 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC