Skij is an interactive Scheme interpreter for the Java environment. Here you can try out Skij running as an applet, assuming your browser supports enough of the JDK 1.1 version of Java. The only one that does, as far as I know, is Netscape Communicator 4. You can also download Skij to run as an application or for use as a debugging interface for your own Java applications.
 


;


 


At the skij> prompt, you can type Scheme forms to be evaluated. Examples follow; some browsers will allow you to cut and paste this text into the applet. Note that you are limited by the applet security model; so much of Java functionality can't be accessed. If you run Scheme as an application these limitations disappear. The applet is also limited by the listener interface; I prefer to run Skij under Emacs, which gives you parenthesis matching, a history mechanism, and automatic indentation.

The classic recursive factorial:

(define (fact n) (if (= n 1) 1 (* n (fact (- n 1)))))
(fact 12)
An example of interactive Java object manipulation: ; make a window
(define w (new 'java.awt.Frame "my window"))
(invoke w 'setSize 300 200)
(invoke w 'setVisible #t)

; make a button
(define b (make-button "Press Me"
                       (lambda (evt)
                          (print "Thanks, that felt good"))))
(invoke w 'add b)
(invoke w 'show)  ; redisplay

Get information about an existing Java object:
(describe *applet*)
Note: if you have Swing installed on your system, try inspect instead of describe.
See the definition of a Scheme procedure:
(ppp make-button) ; pretty-print procedure
Skij can also call JavaScript methods:
(jsinvoke *javascript-window* 'moveBy 100 20)
Note: this doesn't always work due to browser idiosyncracies.

Michael Travers / IBM T. J. Watson Research Center / mt@watson.ibm.com