The MeTTa libraries
!(import! &self (library lib_x)) loads one. The entries below reproduce each library's own (@doc ...) atoms, generated by extensions/python/tools/libdoc.py, so they are true by construction; help! and get-doc answer the same atoms live. The coverage table is the burn-down surface: a library appears below it by gaining @doc atoms beside its definitions.
| library | names | documented |
|---|---|---|
| lib_builtin_types | 191 | 0 |
| lib_combinatorics | 6 | 0 |
| lib_conformance | 1 | 0 |
| lib_constraints | 5 | 0 |
| lib_crypto | 2 | 0 |
| lib_csv | 2 | 2 |
| lib_datastructures | 26 | 9 |
| lib_datetime | 2 | 0 |
| lib_derived | 1 | 1 |
| lib_dict | 7 | 0 |
| lib_distribution | 7 | 0 |
| lib_doc | 0 | 0 |
| lib_file | 18 | 18 |
| lib_gitimport | 0 | 0 |
| lib_he | 0 | 0 |
| lib_import | 2 | 2 |
| lib_json | 0 | 0 |
| lib_measure | 17 | 0 |
| lib_memo | 0 | 0 |
| lib_mm2 | 5 | 0 |
| lib_nars | 38 | 0 |
| lib_observe | 2 | 2 |
| lib_patrick | 4 | 0 |
| lib_pln | 49 | 0 |
| lib_pln2 | 0 | 0 |
| lib_redis | 0 | 0 |
| lib_reflect | 10 | 9 |
| lib_regex | 6 | 0 |
| lib_roman | 36 | 0 |
| lib_soft | 8 | 0 |
| lib_spaces | 5 | 0 |
| lib_strategy | 24 | 0 |
| lib_string | 0 | 0 |
| lib_tabling | 6 | 0 |
| lib_thread | 37 | 0 |
| lib_torch | 20 | 0 |
| lib_vector | 5 | 0 |
| lib_zar | 4 | 0 |
lib_csv
csv-space
lib_csv.metta:22
A read-only CSV row space; each query streams the file anew, every cell is a String, and the first record is data
- a readable UTF-8 CSV file path
Returns: Space
csv-snapshot!
lib_csv.metta:26
Read a CSV file ONCE into an ordinary space of (row Number Field...) atoms; the record number is 1-based, the rows do not change under the program, and repeated queries pay one parse between them
- a readable UTF-8 CSV file path
Returns: Space
lib_datastructures
ft-empty
lib_datastructures.metta:45
The empty finger tree; every other tree grows from it with ft-push-front and ft-push-back.
Returns: FTEmpty
ft-is-empty
lib_datastructures.metta:50
Whether a finger tree holds nothing.
- a finger tree
Returns: True or False
ft-pop-front
lib_datastructures.metta:79
The front element and the remaining tree, as the pair ($x $rest). Popping the empty tree has no answer.
- a nonempty finger tree
Returns: ($front $rest)
ft-pop-back
lib_datastructures.metta:100
The back element and the remaining tree, as the pair ($x $rest): ft-pop-front's mirror.
- a nonempty finger tree
Returns: ($back $rest)
ft-front
lib_datastructures.metta:119
The front element, the tree untouched.
- a nonempty finger tree
Returns: the first element
ft-back
lib_datastructures.metta:126
The back element, the tree untouched.
- a nonempty finger tree
Returns: the last element
ft-from-list
lib_datastructures.metta:136
A finger tree holding the expression's elements in order.
- an expression, for instance (1 2 3)
Returns: a finger tree
ft-to-list
lib_datastructures.metta:146
The elements front to back, as an expression: ft-from-list's inverse.
- a finger tree
Returns: an expression
ft-concat
lib_datastructures.metta:197
Both trees' elements, left then right, in O(log n): the operation finger trees exist to make cheap.
- the left finger tree
- the right finger tree
Returns: one finger tree
Undocumented: FTDeep, FTEmpty, FTSingle, FTree, add-unique-or-fail, dequeue, empty-queue, enqueue, ft-app3, ft-borrow-l, ft-borrow-r, ft-node-digit, ft-nodes, ft-push-back, ft-push-front, ft-push-list-back, ft-push-list-front
lib_derived
once
lib_derived.metta:41
(: once (-> Atom %Undefined%))The first answer of an expression, and no more. Derived here as (take 1 ...); the engine's own once is the same form fused into the compiler
- The expression to take one answer of
Returns: Its first answer
lib_file
make-dir!
lib_file.metta:64
Create a directory and missing parents; an existing directory succeeds
- directory path
Returns: Bool
delete-dir!
lib_file.metta:65
Remove an empty directory; missing or nonempty directories raise
- directory path
Returns: Bool
copy-file!
lib_file.metta:66
Copy bytes to a destination filename with staged replacement; copying onto the source raises
- source file
- destination filename
Returns: Bool
file-metadata!
lib_file.metta:67
Snapshot kind, modified Unix time and file size as queryable atoms in a new space
- file or directory path
Returns: Space
path-join
lib_file.metta:68
Join lexical paths; an absolute second path replaces the first
- directory
- name
Returns: String
path-parent
lib_file.metta:69
Lexical parent directory; a bare filename has parent dot
- path
Returns: String
path-name
lib_file.metta:70
Lexical final path component
- path
Returns: String
path-extension
lib_file.metta:71
Text after the final dot in the filename, without the dot; empty when absent
- path
Returns: String
temp-dir!
lib_file.metta:72
A unique fresh directory in the system temporary directory, created exclusively so concurrent runners cannot mint the same name; the caller owns it and removes it with delete-dir!
- a name prefix, which may not contain a path separator
Returns: String
stdin
lib_file.metta:73
The handle for standard input, which is 0; every handle operation takes it, so (file-read-to-string! (stdin)) reads standard input through EOF
Returns: Number
stdout
lib_file.metta:74
The handle for standard output, which is 1; (file-write! (stdout) $text) writes without a newline
Returns: Number
stderr
lib_file.metta:75
The handle for standard error, which is 2; (file-write! (stderr) $text) is stderr! reached through the handle surface
Returns: Number
stderr!
lib_file.metta:76
Write text to stderr and flush, without adding a newline
- text
Returns: Bool
stdin-to-string!
lib_file.metta:77
Consume standard input through EOF as UTF-8 text
Returns: String
exit!
lib_file.metta:78
Terminate the entire process with integer status 0 through 255; not an application-level return
- process status
temp-path!
lib_file.metta:82
A unique fresh path in the system temporary directory, created exclusively so concurrent runners cannot mint the same name; the caller owns the file
- a name prefix for the path
Returns: String
file-exists
lib_file.metta:86
True when a regular file exists at the path, False otherwise
- the path
Returns: Bool
dir-exists
lib_file.metta:90
True when a directory exists at the path, False otherwise
- the path
Returns: Bool
lib_import
import_prolog_functions_from_file
lib_import.metta:32
Consults a Prolog file and registers the named predicates as MeTTa functions
- the Prolog file, as (library name.pl) or a path
- the predicate names to register
Returns: unit
import_prolog_functions_from_module
lib_import.metta:37
Loads a Prolog module and registers the named predicates as MeTTa functions
- the Prolog module, as (library name.pl) or a path
- the predicate names to register
Returns: unit
lib_observe
trace-source
lib_observe.metta:6
(: trace-source (-> SpaceType String Atom Number SpaceType))Run source in a space and return a space of trace-event atoms. The filter is all or a tuple of exact function names. The limit counts only selected events. trace-stopped records false or the exhausted bound. Evaluation performs the source's writes.
- the execution space
- MeTTa source text
- all or a tuple of function names
- positive event limit
Returns: a space of (trace-event depth kind term answer) and (trace-stopped reason) atoms
observe-source
lib_observe.metta:16
(: observe-source (-> SpaceType String String SpaceType))Run source with coverage and error diagnostics. Source coordinates are one-based Unicode codepoint locations, with exclusive ends. Reports include binary source-coverage flags (0 unexecuted, 1 executed), unchanged source-error values, and source-frame atoms. A generated-by attribution identifies the construct which generated a closure; source-coverage-unavailable explains sites without an independent counter. source-function-unavailable and source-frame-unavailable identify code that has no captured source map. Completed root-form answers survive a later exception. Ordinary execution outside this operation retains no diagnostic state. The source performs its writes in the execution space.
- the execution space
- a source label
- MeTTa source text
Returns: a queryable space of observation-status, observation-answer, observation-exception, source-coverage, source-coverage-unavailable, source-function-unavailable, source-error, source-frame, and source-frame-unavailable atoms
lib_reflect
builtins
lib_reflect.metta:29
Every builtin name, one per solution
special-forms
lib_reflect.metta:32
Every translator special form, one per solution. These are compiled rather than called, so they are in no registry
functions
lib_reflect.metta:36
Every function the engine knows, builtin or not
user-functions
lib_reflect.metta:39
Every function this space defines itself
arity-of
lib_reflect.metta:42
The registered arities for a name, one per solution
- the name
Returns: an arity
knows?
lib_reflect.metta:48
Whether the engine knows a name at all, as True or False
- the name
Returns: True or False
extension-points
lib_reflect.metta:74
Every extension point the engine declares, as (name arity kind), one per solution
Returns: (name arity kind)
surface-counts
lib_reflect.metta:79
How many builtins, special forms, functions and user functions
Returns: ((key count) ...)
surface-json
lib_reflect.metta:86
The engine's whole surface as a JSON string, for external tools
Returns: a JSON string
Undocumented: origin-of