sva40649.scm 508 B

12345678910111213141516171819202122232425262728
  1. (define (f1 f2) (f2))
  2. (define (fa x)
  3. (call-with-current-continuation
  4. (lambda (k)
  5. (define (f3) x)
  6. (f1 f3))))
  7. (define (fb x)
  8. (call-with-current-continuation
  9. (lambda (k)
  10. (define (f3) x)
  11. (f1 f3)
  12. (+ 10 x))))
  13. (format #t "(fb 3): ~w~%" (fb 3))
  14. ;; Output: (fb 3): 13
  15. (define (fc x)
  16. (call-with-current-continuation
  17. (lambda (k)
  18. (define (f3) x)
  19. (f1 f3)
  20. (if (> x 0)
  21. (k (+ 20 x)))
  22. (+ 10 x))))
  23. (format #t "(fb 3): ~w~%" (fc 3))
  24. ;; Output: (fb 3): 23