Caml in JavaScript? Meet CamlScript!

Ladies, gentlemen, fellow geeks and retardz, I present CamlScript.org.

CamlScript is an homage to the old Caml Light system, a lightweight sibling of OCaml and thus a relative of F#. It is currently very orthogonal and somewhat limited in use. But still, it is a toy language with some serious chops. And all of it can run inside your favorite browser.

The language itself features a full type inference engine, user defined datatypes, support for proper tail-recursion, as well as pattern-matching. The webpage features a full-fledged text editor (almost a vanilla Ace editor instance) and a retro-style command line interface (a slightly hacked Josh.js instance).

Please check it out.

Comments

jglascoe's picture

let rec f = fun n ->
  if n < 1 then 1 else n * f (n - 1)
;;
jglascoe's picture

let f = fun n ->
  let rec helper n acc ->
    if n < 1 then acc else helper (n - 1) (n * acc)
  in
    helper n 1
;;
jglascoe's picture

let rec f = fun n cc ->
  if n < 1 then cc 1 else f (n - 1) (fun x -> cc (n * x))
;;