; ; This is Chibi-Scheme compiled with Emscripten to run in the browser. ; (import (scheme base)) (write-string "Hello, world!\n") ; ; You can also run arbitrary JavaScript code from scheme and yield control back and forth between Scheme and the browser ; (import (chibi emscripten)) ; exports: eval-script!, integer-eval-script, string-eval-script, wait-on-event! (write-string (number->string (integer-eval-script "6 * 7"))) (newline) (eval-script! "window.addEventListener('click', function () { Module['resume'](); // give control back to the Scheme process })") (let loop () (wait-on-event!) ; yields control back to the browser (write-string "You have clicked me!\n") (loop)) (write-string "Control never reaches this point\n")
Start Program