Hello World (Alice ML)

From LiteratePrograms

Jump to: navigation, search
Other implementations: Ada | ALGOL 68 | Alice ML | Amiga E | Applescript | AspectJ | Assembly Intel x86 Linux | Assembly Intel x86 NetBSD | AWK | bash | BASIC | Batch files | C | C, Cairo | C, Xlib | Candle | Clojure | C++ | C# | Delphi | Dylan | E | Eiffel | Erlang | Forth | FORTRAN | Fortress | Go | Groovy | Haskell | Hume | IBM PC bootstrap | Inform 7 | Java | Java, Swing | JavaScript | LaTeX | Lisp | Logo | Lua | Maple | MATLAB | Mercury | OCaml/F Sharp | occam | Oz | Pascal | Perl | PHP | Pic | PIR | PLI | PostScript | Prolog | Python | Rexx | Ruby | Scala | Scheme | Seed7 | sh | Smalltalk | SQL | Standard ML | SVG | Tcl | Tcl Tk | Visual Basic | Visual Basic .NET | XSL

This is a simple Alice ML program that prints "Hello, World!" to the console, and then prints the numbers 1 through 10.

<<Helloworld.aml>>=
fun iter i 0 f = ()
  | iter i n f = (f i; iter (i+1) (n-1) f)
do print "Hello, World!\n"
do iter 1 10 (fn i => print(Int.toString i^"\n"))
do OS.Process.exit OS.Process.success

If you have the Alice ML runtime installed, this program can be compiled and executed by typing the following at the OS command line:

alicec Helloworld.aml
alicerun Helloworld.alc
Download code
Views
Personal tools