repl-usage.org 3.0 KB

Starting the REPL

sml

Show sml command help

sml -h

:results: Standard ML of New Jersey v110.79 [built: Sat Oct 26 12:27:04 2019] sml [rtsargs] [options] [files]

rtsargs: @SMLload= (start specified heap image) @SMLalloc= (specify size of allocation area) @SMLcmdname= (set command name) @SMLquiet (load heap image silently) @SMLverbose (show heap image load progress) @SMLobjects (show list of executable objects) @SMLdebug= (write debugging info to file)

files: .cm (CM.make or CM.autoload) -m (switch to CM.make) -a (switch to CM.autoload; default) .sig (use) .sml (use) .fun (use)

options: -D= (set CM variable to given value) -D (set CM variable to 1) -Uname (unset CM variable) -C= (set named control) -H (produce complete help listing) -h (produce minimal help listing) -h (help with obscurity limit) -S (list all current settings) -s (limited list of settings) -E (list all environment variables) -e (limited list of environment variables)

SML/NJ controls: Compilation Manager (CM): :end:

Inside REPL

Loading a program

Corresponding to (load "file.scm") in Scheme:

use "filename";

Opening a library

Opening a library will introduce its bindings into the current environment:

open "filename"; (* or *) open structure_name;

Directories

Current directory

OS.FileSys.getDir();

Change directory

OS.FileSys.chDir("filename");

Use compilation manager

CM.make "file.cm";

Find more info at https://www.smlnj.org/doc/CM/index.html.

Exiting the REPL

Either use C-d or run the following code:

OS.Process.exit(OS.Process.success);

More info

Some links: