Run MetaOCaml code

424 views Asked by At

I have just installed BER MetaOCaml with the following :

 $ opam update
 $ opam switch 4.02.1+BER
 $ eval `opam config env`

and I am not able to run MetaOCaml code in tuareg toplevel or simply ocaml toplevel. Following code :

let a = .<1+2>.;;

results in

Error: Reference to undefined global `Trx'

I have tried #load "trx.cma" but it cannot find the file.

Answer edit :

metaocaml is the right executable.

After adding this :

`(defun tuareg-run-metaocaml ()
    "Run an OCaml toplevel process.  I/O via buffer `*ocaml-toplevel*'."
    (interactive)
    (tuareg-run-process-if-needed
     "/usr/bin/opam config exec -- metaocaml")
    (display-buffer tuareg-interactive-buffer-name))

  (add-hook 'tuareg-mode-hook
        ' (lambda ()
              (define-key tuareg-mode-map (kbd "C-c M-s")
            'tuareg-run-metaocaml)))`

To my .emacs, I am now able to run MetaOCaml with C-c M-s.

0

There are 0 answers