Skip to content

Instantly share code, notes, and snippets.

@saml
Created April 2, 2011 02:15
Show Gist options
  • Save saml/899174 to your computer and use it in GitHub Desktop.
Save saml/899174 to your computer and use it in GitHub Desktop.
#include "include.dats"
(*
argc starts with 1 (includes ./prog-name)
argv is an array. array elements can be accessed with arr[index]
without argc > 1 conditional, argv[1] won't compile!!!!!
*)
implement main (argc, argv) = begin
if argc > 1 then
printf ("Hello, %s\n", @(argv[1]))
else
printf ("Usage: %s your-name\n", @(argv[0]))
end
(* including various useful libraries *)
#ifndef ATSINCLUDE
#define ATSINCLUDE
//these are a must for all programs
staload _ = "libc/SATS/stdio.sats"
staload _ = "prelude/DATS/array.dats"
staload _ = "prelude/DATS/array0.dats"
staload _ = "prelude/DATS/list.dats"
staload _ = "prelude/DATS/list0.dats"
staload _ = "prelude/DATS/list_vt.dats"
staload _ = "prelude/DATS/matrix.dats"
staload _ = "prelude/DATS/matrix0.dats"
staload _ = "prelude/DATS/option.dats"
staload _ = "prelude/DATS/option0.dats"
staload _ = "prelude/DATS/pointer.dats"
staload _ = "prelude/DATS/reference.dats"
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment