The AIDDL Core Library contains everything needed to use AIDDL in a specific programming language. Here we document the functionality expected from every Core implementation.
AIDDL files (modules) are parsed into containers. Containers are essentially sets of modules with some additional functionality, e.g., to resolve references. An AIDDL module is a collection of entries. Each entry is composed of a type, a name, and a value.
Contains URIs and implementations of default evaluator functions, defined functions, and loaded functions. Used by evaluator and request handler to call functions given their URI.
Tuples whose first element is a function URI may be evaluated. This is often used as part of a condition or type definition. The following is a complete list of all implemented evaluator functions that should be supported by every implementation of the AIDDL Core Library.
Most lower case symbols (
Name | Arguments | Description |
---|---|---|
org.aiddl.eval | ||
call | Call function referred to by |
|
lambda | Create reference to anonymous function defined by |
|
quote | ||
type |
|
Check if |
signature |
|
|
equals |
|
|
not-equals |
|
|
matches |
|
|
first | first element of |
|
last | last element of |
|
size | ||
get-key |
|
|
get-idx | $n$th element of |
|
let | ||
if | if |
|
cond |
|
|
map | ||
filter | ||
reduce | ||
match | ||
zip | ||
key | ||
value | ||
.logic | ||
not | true if |
|
and | true if all |
|
or | true if any |
|
forall | $∀e ∈ C ∃_σ : e_i = m σ ∧ x σ = true$ | |
exists | $∃e ∈ C ∃_σ : e_i = m σ ∧ x σ = true$ | |
.collection | ||
in | ||
contains | ||
contains-all | ||
contains-any | ||
contains-match | $∃e ∈ C, σ : mσ = e$ | |
add-element | ||
add-all | ||
remove | ||
remove-all | ||
sum | $∑e ∈ C e$ | |
.collection.list | ||
concat | ||
% head | first element of |
|
% tail | last element of |
|
% cut-head |
|
|
% cut-tail |
|
|
.collection.set | ||
union | ||
.numerical | ||
add | ||
sub | ||
mult | ||
div | ||
modulo | ||
greater-than | ||
greater-than-eq | ||
less-than | ||
less-than-eq | ||
.term | ||
term | true | |
numerical |
|
|
integer |
|
|
rational |
|
|
real |
|
|
infinity |
|
|
symbolic |
|
|
boolean |
|
|
string |
|
|
variable |
|
|
reference |
|
|
fun-ref |
|
|
collection |
|
|
list |
|
|
set |
|
|
tuple |
|
|
key-value |
|
The request handler allows to compose function calls with common imperative control structures.
The following list provides a short overview of requests with examples.
Call functionality on input and write result to output:
(call plan (s0 g O) pi)
Execute requests in a sequence:
[R1 R2 R3]
Execute request while condition is true:
(while (< acc 0.95) plan-and-learn)
For each combination of variable-value pairs, create a substitution and call R substituted.
(forall [?x:[a b] ?y:[1 2]] (call f (?x ?y) o))
Loop indefinitely:
(loop [sense plan act])
Match two terms and execute request on the resulting substitution if possible:
(match (?x ?y) ((1 2) (3 4))(call dist (?x ?y) d))
If condition holds execute first request, otherwise execute second (optional) request:
(if (x < 10) R1 R2)
Write evaluated expression to entry:
(if (+ 10 12) n)
Create entry:
(create (#integer n 10))
Print message:
(print Source (x $x))
Measure time between two points:
(stopwatch start A1) (call Plan $Pi pi) (stopwatch stop A1)