Skip to content

Instantly share code, notes, and snippets.

@mndrix
Last active October 31, 2016 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mndrix/00a9c50ecd7fe70acb4c912fc085570b to your computer and use it in GitHub Desktop.
Save mndrix/00a9c50ecd7fe70acb4c912fc085570b to your computer and use it in GitHub Desktop.
Hello Amalog
use("amalog.org/std/io", Io); # See Note_use
main(W) {
Io.printf(W, "Hello, world!\n");
}
### Note_use:
`use/2` is a macro that expands into
at(now) {
Core.load("amalog.org/std/io", Io);
Core.make_global(Io); # only callable at compile time
}
where `at/1` schedules execution at the runtime stage indicated.
`now` is "as soon as possible during compilation".
`use/2` has to be a macro because `Core.make_global/1` has
to operate on the variable itself not an alias.
`load/2` parses a directory of Amalog files into a database.
###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment