0

I'm attempting to write a list of integers to a file of bytes with the following code:

let out_channel = open_out_bin "G:\\JVM\\OcamlTest2.class";;

let writeBytes out_channel finalBytes = 
match finalBytes with
| [] -> close_out out_channel
| hd::tl -> output_byte out_channel hd; writeBytes out_channel tl;;

And I get the following error:

Error: Unbound value writeBytes

How can I fix this?

David Farthing
  • 237
  • 2
  • 13
  • 1
    You should update your title since the problem is not about what you want to do but some syntax error. – Lhooq May 23 '16 at 18:44

1 Answers1

7

Recursive functions defined with let rec in OCaml, see this answer for details.

Community
  • 1
  • 1
larhat
  • 443
  • 2
  • 5