Anarki: Community-Managed Arc Variant
(require anarki) | package: anarki |
This module makes it possible to load scripts made for Anarki from Racket.
Documentation on Anarki as a language is available at the Anarki website.
1 Quick Experimentation
Specifically, this initializes the Anarki main namespace verbosely, then runs a REPL with current-directory set to the Anarki installation directory and current-namespace set to the Anarki main namespace. It’s equivalent to the following:
(anarki-init-in-main-namespace-verbose) (parameterize ([current-directory anarki-path] [current-namespace anarki-main-namespace] [current-readtable anarki-readtable]) (anarki-repl))
2 Initializing
procedure
(anarki-init) → void?
(anarki-init-verbose) → void? (anarki-init-in-main-namespace) → void? (anarki-init-in-main-namespace-verbose) → void?
For the "-in-main-namespace" variants, the namespace initialized is anarki-main-namespace, and the initialization is entirely skipped if either of these variants has been called before.
For the other variants, the namespace initialized is (current-namespace), and if the namespace has already been initialized, it’s initialized again. This can even be used to double-initialize anarki-main-namespace.
The "-verbose" variants may print messages to (current-error-port) to report on the initialization progress.
3 Evaluating Code
procedure
(anarki-eval expr) → any
expr : any/c
procedure
(anarki-load path) → void?
path : path-string?
procedure
(anarki-repl) → (or/c null 'done)
This does not perform any initialization of the readtable or the namespace before it starts. For that purpose, use one of the variants of anarki-init.
4 Typical Context
value
value
(parameterize ([current-namespace anarki-main-namespace] [current-readtable anarki-readtable]) (anarki-load "my-file.arc"))
value
A complete News example:
(anarki-init-in-main-namespace-verbose) (parameterize ([current-directory anarki-path] [current-namespace anarki-main-namespace] [current-readtable anarki-readtable]) (anarki-load "lib/news.arc") (anarki-eval '(nsv)))