[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


This page is part of the web mail archives of SRFI 31 from before July 7th, 2015. The new archives for SRFI 31 contain all messages, not just those from before July 7th, 2015.

As an alternative to your 'rec', there's the fixed-point-finding function 
'call-with-result' that I implemented in my Scheme interpreter HScheme. 
call-with-result calls a function, passing to it the result that the 
function will return. For instance:

  (define factorial (call-with-result (lambda (fact)
    (lambda (x)
      (if (equal? x 0) 1 (* x (fact (- x 1))))

  (define stream1 (call-with-result (lambda (s)
    (cons 1 s)

It's a little time-travel trick. You can try it out here:

Unfortunately call-with-result seems to be incompatible with CPS (and 
apparently therefore with call-with-current-continuation), so the 
resulting Scheme isn't R5RS. HScheme comes in both flavours, but is not 
yet R5RS-complete for other reasons.

Ashley Yakeley, Seattle WA