In SML
's repl
, you can just type use whatever.sml
and load all things inside that .sml
into repl
.
How can I do that in OCaml?
You have #use
directive for that purpose:
#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.
For example (as per @gasche's suggestion):
# #use "whatever.ml";;
Here is a complete list of OCaml directives.