MetaOCaml : Can't run code from brackets

171 views Asked by At

I am trying MetaOCaml, so I have made this fantastic code :

#let a = .<1>.;;
val a : int code = .<1>. 
# let b = !. a;;
Error: Unbound value !.
# let b = .!a;;
Error: Syntax error

Why doesn't it work ?

Also, I have tried !. and .! because I have seen both on websites but don't know which one is the right one.

1

There are 1 answers

2
Nicolas Scotto Di Perto On

I figured it out from http://okmij.org/ftp/ML/MetaOCaml.html

Runcode module needs to be opened to use !. and not .! which is syntaxly incorrect.

A correct execution would be :

#let a = .<1>.;;
val a : int code = .<1>. 
#open Runcode;;
#!.a;;
- : int = 1