Module exec

Basic builtin predicates for execution control

Contents

Predicate


Top of this page Contents Index of this package LiLFeS Documents LiLFeS Home Page Tsujii laboratory

Predicate

dynamic/1

Formatdynamic(+$PRED)
Arguments
+$PREDpred predicate
Declare to allow predicate $PRED to assert.
> :- dynamic(cky_table).
  
 Declare to allow predicate "cky_table" to assert.

is_dynamic/1

Formatis_dynamic(+$PRED)
Arguments
+$PREDpred predicate
See alsodynamic/1
Return true if predicate $PRED is dynamic.
> ?- is_dynamic(cky_table).
 yes
  
 Return true if predicate "cky_table" is dynamic.

multifile/1

Formatmultifile(+$PRED)
Arguments
+$PREDpred predicate
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.

is_multifile/1

Formatis_multifile(+$PRED)
Arguments
+$PREDpred predicate
See alsodynamic/1
Return true if predicate $PRED is multifile.
> ?- is_multifile(newwill_query).
 yes
  
 Return true if predicate "newwill_query" is dynamic.

disp_result/1

Formatdisp_result(+FS)
Arguments
+FSbot feature structure
Display the result of a query and wait for input.

eval/2

Formateval(+STRING, -PREDLIST)
Arguments
+STRINGstring :LiLFeS program(string)
-PREDLISTlist :list of predicate
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     _|_|

eval/3

Formateval(+STRING, -PREDLIST,-VARLIST)
Arguments
+STRINGstring :LiLFeS program(string)
-PREDLISTlist :list of predicate
-VARLISTlist :list of variables
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: < < > >

call/1

Formatcall(+$X)
Arguments
+$X(pred) feature structure(predicate)
execute predicate indicate feature structure $X.
> :- call(strprintln("a")).
 a
 > ?- call(X = person).
 X: person

findall/3

Formatfindall(+$TEMPLATE, +$GENARATOR, -$BAG)
Arguments
+$TEMPLATE template of wanted form
+$GENARATOR predicate to examine
-$BAGlist result list
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_|

findall/4

Formatfindall(+$TEMPLATE, +$GENARATOR, -$BAG,-$TAIL)
Arguments
+$TEMPLATE template of wanted form
+$GENARATOR predicate to examine
-$BAGlist result list
-$TAILlist the end of result list
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_|

assert/1

Formatassert(+$C)
Arguments
+$C definition clause
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.

asserta/1

Formatasserta(+$C)
Arguments
+$C definition clause
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.

halt/0

Formathalt
See alsohalt/1
Halt lilfes with return code 0
 :- halt.

halt/1

Formathalt(+$C)
Arguments
+$Cinteger return code
Halt lilfes
 :- halt(1).

Top of this page Contents Index of this package LiLFeS Documents LiLFeS Home Page Tsujii laboratory

This document is automatically created by lildoc on Fri Sep 24 14:13:57 2004