Rainbow.js

(The "Eval" button is just there in case pressing enter doesn't work for you. This may be useful on mobile in particular.)

Above is a REPL for Rainbow.js, an implementation of most of Rainbow, which is an implemenation of Arc. By default, we don't load arc.arc or friends automatically yet, but you can enter (load-from-web) to load them manually or put "#libs" on the end of the URI to refresh the page such that the libraries are loaded automatically.

Doing JavaScript things

Besides load-from-web, this REPL defines another global: window, the page's window object. You can use it with (the poorly named) java-invoke like so (assuming no libraries loaded):

arc> (assign list (fn a a))
(fn a a)
arc>
  (assign jsget-impl
    (java-invoke
      window 'eval (list "(function ( o, k ) { return o[ k ]; })")))

function ( o, k ) { return o[ k ]; }
arc>
  (assign jsget
    (fn (o k) (java-invoke jsget-impl 'call (list nil o k))))

(fn (o k) (java-invoke jsget-impl 'call (list nil o k)))
arc> (jsget window "Object")
function Object() { [native code] }

Using arbitrary JavaScript code like this, you could poke around in Rainbow.js's internals. However, all the JavaScript code this page uses is minified, so if you have a goal that ambitious, we recommend actually checking out the Rainbow.js repo and modifying the source code. :-p

The java-invoke function takes care of some simple type conversions for you, like converting between host-language strings and Arc strings automatically:

arc>
  (+ "The title of the page is: "
     (jsget (jsget window "document") "title"))

"The title of the page is: It's Rainbow in JavaScript!"