lib-cycle.scm 626 B

12345678910111213141516171819202122
  1. (define-library (evn)
  2. (import (scheme base) (odd))
  3. (cond-expand ((library (java lang no-such))
  4. (define d e f)))
  5. (cond-expand ((library (scheme base))
  6. (begin
  7. (define (is-even? (x :: <int>)) :: <boolean>
  8. (if (= x 0) #t (is-odd? (- x 1)))))
  9. (export is-even?))))
  10. (define-library (odd)
  11. (import (scheme base) (evn))
  12. ;; Not allowed in pedantic r7rs
  13. (define (is-odd? (x :: <int>)) :: <boolean>
  14. (if (= x 0) #f (is-even? (- x 1))))
  15. (export is-odd?))
  16. (import (odd))
  17. (format #t "odd(21): ~w~%" (is-odd? 21))
  18. ;; Output: odd(21): #t