How to import a source file to OCaml’s toplevel?

How to import a source file to OCaml’s toplevel? Say, I want to use a function implemented in a source file in the toplevel.

#use "file-name";; 

Read, compile and execute source phrases from the given file. This is textual inclusion: phrases are processed just as
if they were typed on standard input. The reading of the file stops at
the first error encountered.

More Toplevel directives: http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual023.html

Leave a Reply

Your email address will not be published. Required fields are marked *