This is prototype of an OCaml toplevel compiled to Javascript and used as a kernel for the IPython notebook.
Basic code execution seems to be fine.
In [1]:
let a = 20
let b = 40
let c = a + b
Out[1]:
Out[1]:
Out[1]:
Data written to the Pervasives
stdout
and stderr
channels are redirected to the notebook.
In [2]:
Printf.printf "c = %i\n" (c+1)
Out[2]:
In [3]:
Printf.fprintf stderr "c = %s\n" (string_of_int (c*2))
Out[3]:
The io code in the dev version does buffering - I think until a flush or newline.
In [4]:
Printf.printf "hello"
Out[4]:
...nothing yet...
In [5]:
Printf.printf "\n"
Out[5]:
We have access to the same Iocaml.display function call (but no mime channel).
In [9]:
Iocaml.display "text/html" "<b>hello</b> <i style=\"color:green\">world</i>"
Out[9]:
To avoid compiler messages dominating the output cells they are by default limited to a height of 100px. This can be changed by setting the string ref
Iocaml.output_cell_max_height
.
To see the full message just click on it.
In [4]:
Iocaml.output_cell_max_height := "50px";;
Array.init 1000 (fun i -> i);;
Out[4]:
Out[4]:
In [ ]: