- 1.1.5
This library provides general purpose multifile shorthand/3 and expand/1 expand/2 metapredicates for introducing shorthand functional notations.
- defined here for allowing conditional expression
if(Condition, Expr1, Expr2)
in expressions;
- proposed for allowing global variables in expressions by adding clauses to shorthand/3;
- defined in
library(comprehension)
for let(Bindings, Expr)
expressions similarly to let/2 goal predicate defined there;
- in
library(arrays)
for Array[Indices] functional notation,
- in
library(clp)
for sum(VarDomains, Expr)
expressions with sum/3 constraint, and for all other constraints where the last argument can be seen as a result.
?- X = -2, expand(Y is if(X>0, X, -X)).
X = -2,
Y = 2.
?- nb_setval(n, 42).
true.
?- asserta(user:shorthand(n, V, nb_getval(n, V))).
true.
?- expand(X is n^2).
X = 1764.
In addition, metapredicates apply_list/2 and call_list/2 up to call_list/6 are defined here,
for calling a predicate to a list of arguments similarly to maplist/2 but without transposing the arguments: