Anarki:   Community-Managed Arc Variant
1 Quick Experimentation
anarki
2 Initializing
anarki-init
anarki-init-verbose
anarki-init-in-main-namespace
anarki-init-in-main-namespace-verbose
3 Evaluating Code
anarki-eval
anarki-load
anarki-repl
4 Typical Context
anarki-readtable
anarki-main-namespace
anarki-path
7.0

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

    2 Initializing

    3 Evaluating Code

    4 Typical Context

1 Quick Experimentation

procedure

(anarki)  (or/c null 'done)

An easy entrypoint to the Anarki REPL from the Racket REPL.

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

Initializes a namespace with the Arc primitives, so that it can be used to evaluate Arc code. This can take a while to complete.

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
Evaluates an s-expression of Arc code in (current-namespace).

procedure

(anarki-load path)  void?

  path : path-string?
Loads the given file of s-expressions as Arc code in (current-namespace), reading them with (current-readtable).

procedure

(anarki-repl)  (or/c null 'done)

Begins an read-eval-print loop interacting over (current-input-port) and (current-output-port), reading s-expressions using (current-readtable) and evaluating them as Arc code in (current-namespace).

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

The readtable used for Arc code.

The namespace in which #lang anarki modules are loaded. It’s recommended to load Arc code into this namespace most of the time.

(parameterize ([current-namespace anarki-main-namespace]
               [current-readtable anarki-readtable])
  (anarki-load "my-file.arc"))

The system path to the directory where Anarki is installed. Most of Anarki’s libraries are distributed in the "lib" directory under this path, and most of them expect current-directory to be set to this path so they can load each other or store their application state.

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)))