I'm trying to write a bunch of functions in an SML file and then load them into the interpreter. I've been googling and came across this:
http://www.smlnj.org/doc/interact.html
Which has this section:
Loading ML source text from a file
The function use: string -> unit interprets its argument as a file name relative to sml's current directory and loads the text from that file as though it had been typed in. This should normally be executed at top level, but the loaded files can also contain calls of use to recursively load other files.
So I have a test.sml file in my current directory. I run sml
, all good so far. Then I try use test.sml;
and I get:
stdIn:1.6-1.14 Error: unbound structure: test in path test.sml
Not sure why this isn't working. Any ideas?
Thanks, bclayman
As you mentioned, the function
use
has typestring -> unit
. This means it takes astring
and returnsunit
. When you douse test.sml
, you are not giving it a string. You need to douse "test.sml"
(notice the quotes)