Skip to content

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.

librarynamesdocumented
lib_builtin_types1900
lib_combinatorics60
lib_conformance10
lib_constraints50
lib_crypto20
lib_datastructures269
lib_datetime20
lib_derived11
lib_dict70
lib_doc00
lib_file33
lib_gitimport00
lib_he00
lib_import22
lib_json00
lib_measure160
lib_memo00
lib_mm250
lib_nars380
lib_patrick40
lib_pln490
lib_redis00
lib_reflect109
lib_regex60
lib_roman360
lib_soft50
lib_spaces50
lib_strategy240
lib_string00
lib_tabling60
lib_thread370
lib_torch200
lib_vector50
lib_zar40

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.

  1. 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.

  1. 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.

  1. a nonempty finger tree

Returns: ($back $rest)

ft-front

lib_datastructures.metta:119

The front element, the tree untouched.

  1. a nonempty finger tree

Returns: the first element

ft-back

lib_datastructures.metta:126

The back element, the tree untouched.

  1. 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.

  1. 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.

  1. 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.

  1. the left finger tree
  2. 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

metta
(: 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

  1. The expression to take one answer of

Returns: Its first answer

lib_file

temp-path!

lib_file.metta:40

A unique fresh path in the system temporary directory, created exclusively so concurrent runners cannot mint the same name; the caller owns the file

  1. a name prefix for the path

Returns: String

file-exists

lib_file.metta:44

True when a regular file exists at the path, False otherwise

  1. the path

Returns: Bool

dir-exists

lib_file.metta:48

True when a directory exists at the path, False otherwise

  1. 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

  1. the Prolog file, as (library name.pl) or a path
  2. 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

  1. the Prolog module, as (library name.pl) or a path
  2. the predicate names to register

Returns: unit

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

  1. the name

Returns: an arity

knows?

lib_reflect.metta:48

Whether the engine knows a name at all, as True or False

  1. 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

Released under the MIT License.