I am trying to implement a return function in an R6RS schema. I want something like that:
(lambda () (do-some-job-before) (return some-value) (do-some-job-after))
executes (do-some-job-before) , does not (do-some-job-after) and the final value of the lambda function in some-value .
I think I should use the sequel. I tried:
(define return #f) (call/cc (lambda (k) (set! return k)))
but it does not work; eg
(+ 2 (return 3)) ; -> 3 (and not 5 as I expected)
How can i do this?
source share