Re: args when running from the command line
Matthias Blume <[email protected]> Tue, 8 Jul 2008 11:46:00 -0500
| Newsgroups | gmane.comp.lang.sml.smlnj |
|---|---|
| Message-ID | <[email protected]> |
On Jul 8, 2008, at 12:20 AM, brian wrote:
> It looks like you can't get command line args when running sml thusly;
>
> sml files.sml arg1 arg2 ...
>
Actually, you can:
$ cat foo.sml
let val l = CommandLine.arguments ()
in app (fn x => (print x; print "\n")) l;
OS.Process.exit OS.Process.success : unit
end
$ sml foo.sml a b c d e
Standard ML of New Jersey v110.67 [built: Mon Jul 7 11:15:34 2008]
[opening foo.sml]
[autoloading]
[library $SMLNJ-BASIS/basis.cm is stable]
[autoloading done]
a
b
c
d
e
$
>
> Is there anyway, maybe using some os function to exit instead of
> entering the repl ?
See the code snippet above. The function you are looking for is
OS.Process.exit.
Hope this helps...
Matthias
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/