seanjensengrey / mosh-scheme

Automatically exported from code.google.com/p/mosh-scheme
Other
0 stars 0 forks source link

receive(call-with-values) primitive does not perform proper-tail-recursion #204

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
call-with-values' consumer procedure should have tail-context according to R6RS 
11.15

(import (rnrs))

(define (x)
  (call-with-values (lambda () 'a)
                    (lambda (a) (x))))

(x)

but this causes stack-overflow.

Original issue reported on code.google.com by oku...@gmail.com on 20 Apr 2011 at 12:38

GoogleCodeExporter commented 9 years ago
Fixed.
Actually, this is not a problem on receive or call-with-values.
The apply procedure was not proper tail recursive.

You can reproduce a stack overflow on apply with the following code.

(define (x  a)
  (let1 val 'a (apply x (list val))))

(x 3)

Original comment by hige...@gmail.com on 25 Apr 2011 at 1:57