| Format | dynamic(+$PRED) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Declare to allow predicate $PRED to assert. | ||||
> :- dynamic(cky_table). Declare to allow predicate "cky_table" to assert. | ||||
| Format | is_dynamic(+$PRED) | |||
|---|---|---|---|---|
| Arguments |
| |||
| See also | dynamic/1 | |||
| Return true if predicate $PRED is dynamic. | ||||
> ?- is_dynamic(cky_table). yes Return true if predicate "cky_table" is dynamic. | ||||
| Format | multifile(+$PRED) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Declare to allow predicate $PRED to describe its main definition on other module. | ||||
> :- multifile(newwill_query). Declare to allow predicate "newwill_query" to describe its main definition on other module. | ||||
| Format | is_multifile(+$PRED) | |||
|---|---|---|---|---|
| Arguments |
| |||
| See also | dynamic/1 | |||
| Return true if predicate $PRED is multifile. | ||||
> ?- is_multifile(newwill_query). yes Return true if predicate "newwill_query" is dynamic. | ||||
| Format | disp_result(+FS) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Display the result of a query and wait for input. | ||||
| Format | eval(+STRING, -PREDLIST) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Analyse LiLFeS program STRING and return list of predicate PREDLIST. | |||||||
> ?- eval("strprintln(""a"").",X).
|~lilfesfilecons ~|
| hd:|~strprintln~| |
| |_arg1:"a" _| |
X: | tl:< > |
| |~lilfesfileinfo ~| |
| lilfesfileinfo:| lilfesfilename:"eval" | |
|_ |_lilfesfileline:1 _|_|
| |||||||
| Format | eval(+STRING, -PREDLIST,-VARLIST) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Arguments |
| |||||||||
| Analyse LiLFeS program STRING and return list of predicate PREDLIST and list of variables VARLIST. | ||||||||||
> ?- eval("strprintln(""a"").",X,Y).
|~lilfesfilecons ~|
| hd:|~strprintln~| |
| |_arg1:"a" _| |
X: | tl:< > |
| |~lilfesfileinfo ~| |
| lilfesfileinfo:| lilfesfilename:"eval" | |
|_ |_lilfesfileline:1 _|_|
Y: < < > >
| ||||||||||
| Format | call(+$X) | |||
|---|---|---|---|---|
| Arguments |
| |||
| execute predicate indicate feature structure $X. | ||||
> :- call(strprintln("a")).
a
> ?- call(X = person).
X: person
| ||||
| Format | findall(+$TEMPLATE, +$GENARATOR, -$BAG) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Arguments |
| |||||||||
| Make a list which result from backtracking . | ||||||||||
(Basic type) > x <- [bot]. y <- [bot]. z <- [bot]. > t <- [pred]. u <- [pred]. > t(x). > t(y). > t(z). > ?- findall(X, t(X), S). S: < x, y, z > X: bot (Get the pairs of success.) > u(X,Y) :- t(X), t(Y). > ?- findall([A,B], u(A,B), S). A: bot B: bot S: < < x, x >, < x, y >, < x, z >, < y, x >, < y, y >, < y, z >, < z, x >, < z, y >, < z, z > > (Put the result in a feature structure.) > xt <- [bot] + [ONE\, TWO\]. > ?- findall( (ONE:A, TWO:B), u(A,B), S). A: bot B: bot |~xt ~| |~xt ~| |~xt ~| |~xt ~| |~xt ~| |~xt ~| S: < | ONE:x |, | ONE:x |, | ONE:x |, | ONE:y |, | ONE:y |, | ONE:y |, |_TWO:x_| |_TWO:y_| |_TWO:z_| |_TWO:x_| |_TWO:y_| |_TWO:z_| |~xt ~| |~xt ~| |~xt ~| | ONE:z |, | ONE:z |, | ONE:z | > |_TWO:x_| |_TWO:y_| |_TWO:z_| | ||||||||||
| Format | findall(+$TEMPLATE, +$GENARATOR, -$BAG,-$TAIL) | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||||||||
| Make a list which result from backtracking. | |||||||||||||
(Basic type) > x <- [bot]. y <- [bot]. z <- [bot]. > t <- [pred]. u <- [pred]. > t(x). > t(y). > t(z). > ?- findall(X, t(X), S). S: < x, y, z > X: bot (Get the pairs of success.) > u(X,Y) :- t(X), t(Y). > ?- findall([A,B], u(A,B), S). A: bot B: bot S: < < x, x >, < x, y >, < x, z >, < y, x >, < y, y >, < y, z >, < z, x >, < z, y >, < z, z > > (Put the result in a feature structure.) > xt <- [bot] + [ONE\, TWO\]. > ?- findall( (ONE:A, TWO:B), u(A,B), S). A: bot B: bot |~xt ~| |~xt ~| |~xt ~| |~xt ~| |~xt ~| |~xt ~| S: < | ONE:x |, | ONE:x |, | ONE:x |, | ONE:y |, | ONE:y |, | ONE:y |, |_TWO:x_| |_TWO:y_| |_TWO:z_| |_TWO:x_| |_TWO:y_| |_TWO:z_| |~xt ~| |~xt ~| |~xt ~| | ONE:z |, | ONE:z |, | ONE:z | > |_TWO:x_| |_TWO:y_| |_TWO:z_| | |||||||||||||
| Format | assert(+$C) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Note | $C must be described without period.For example,"assert(p(a))." or "assert(p(X):- q(X)). " | |||
| Add a new definition clause $C. | ||||
> p <- [pred]. a <- [bot]. b <- [bot]. > p(a). > :- assert(p(b)). > ?- p(X). X: a Enter ';' for more choices, otherwise press ENTER --> ; X: b "p(b)" is added after definition of predicate p "p(a)" by assert. | ||||
| Format | asserta(+$C) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Note | $C must be described without period.For example,"assert(p(a))." or "assert(p(X):- q(X)). " | |||
| Add a new definition clause $C to the top of predicate definition. | ||||
> p <- [pred]. a <- [bot]. b <- [bot]. > p(a). > :- asserta(p(b) :- !). > ?- p(X). X: b Enter ';' for more choices, otherwise press ENTER --> ; no "p(b):-!" is added after definition of predicate p "p(a)" by asserta.On call of p in query,the definition clause added by asserta has priority,so p(b) success and restrain backtrack by "!",so the old definition p(a) is not called. | ||||
| Format | halt |
|---|---|
| See also | halt/1 |
| Halt lilfes with return code 0 | |
:- halt. | |
| Format | halt(+$C) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Halt lilfes | ||||
:- halt(1). | ||||