sva36917.scm 489 B

123456789101112131415161718192021
  1. ;; Java-options: "-Xmx20m"
  2. (define-variable n 1)
  3. (let ((lambda '(begin (define-variable n)
  4. ((lambda ()
  5. (set! n (+ n 2)))))))
  6. ; (+ x 42))))
  7. (let loop ((i 0))
  8. #|cd ..
  9. (when (= (mod i 1000) 0)
  10. (format #t "~d: ~:d\n" i ((java.lang.Runtime:getRuntime):totalMemory))
  11. (force-output))
  12. |#
  13. (eval lambda)
  14. (if (< i 10000)
  15. ;(if (< i 50)
  16. (loop (+ i 1)))))
  17. (format #t "Done ~d.~%" n)
  18. ;; Output: Done 20003.