cycle1.scm 604 B

12345678910111213141516171819202122232425
  1. (module-name <cycle1>)
  2. (module-export is-even? cycle1-name1 cycle1-name2 cycle1-name3 c1x double-c2x)
  3. (define (double-c2x)
  4. (set! c2x (* 2 c2x)))
  5. (require "cycle2.scm")
  6. ;; Check that c1, c2, and <cycle1> all evaluate to java.lang.Class objects.
  7. (define-alias c1 <cycle1>)
  8. (define-namespace c2 <cycle1>)
  9. (define (cycle1-name1) c1)
  10. (define (cycle1-name2) c2)
  11. (define (cycle1-name3) <cycle1>)
  12. (define one :: <int> -2)
  13. ; Verifies that body is executed exactly once.
  14. (set! one (+ one 3))
  15. (define (is-even? (x :: <int>)) :: <boolean>
  16. (if (= x 0) #t (is-odd? (- x one))))
  17. (define c1x 2)
  18. (double-c1x)