简体   繁体   中英

Ocaml error unbound Value

When i try to evaluate line 2 or 5 of this program, i get "Unbound value carre" or "Unbound value bis". To evaluate it i use emacs with tuareg, could it be related ?

let carre x = x*x;;
carre(9);;

let bis y = y^y;;
bis("ab");;

For example, here is what i get for line 2 :

# Characters 0-5:
  carre(9);;
  ^^^^^
Error: Unbound value carre
# 

The code is very simple so i feel like the problem comes from emacs. I've tried to change function names, variables names, but nothing worked. Does anybody see what's wrong here ?

You need to evaluate the first line of your program before the second.

The interpretor doesn't know the definition of carre or bis until you've evaluated it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM