Built-In ListLast update: 21-01-2001 Version 4.0.2 |
| Home | Presentation | JIP Console | Intelligent Applets | API | Download | Contacts |
Built-in predicates currently implemented: =/2 : term1 = term2 Succeeds
if term1 and term2
unify. \=/2 : term1 \= term2 Succeeds if term1 does not
unify with term2, and never binds any variables. ==/2 : term1 == term2 Succeeds
if term1 is
identical to term2. No variables in term1 and term2
are bound as a result of the testing. \==/2 : term1 \== term2 Succeeds
if term1 is not
identical to term2 >/2 : exp1 > exp2 Succeeds
if the arithmetic expression
exp1 is greater than exp2. </2 : exp1 < exp2 Succeeds
if the arithmetic expression
exp1 is less than exp2. >=/2 : exp1 >= exp2 Succeeds
if the arithmetic expression
exp1 is greater than or equal to exp2. <=/2 : exp1 <= exp2 Succeeds
if the arithmetic expression
exp1 is less than or equal to exp2. =:=/2 : exp1 =:= exp2 Succeeds
if the arithmetic expression
exp1 evaluates to exp2. =\=/2 : exp1 =:= exp2 Succeeds
if the arithmetic expression
exp1 doesn't evaluates to exp2. =../2 : Term =.. List List is a list whose first element is the principal functor of the
Term, and whose tail is the list of arguments of Term. \+/1 : \+ call Logical not. Succeeds if call fails. see also: not/1 !/0 The predicate !/0 always succeeds, but it has the important side effect of removing pending choice points within the current clause and relation. Its purpose is to enable programs to commit to solutions, and to retrieve space that would otherwise be tied up in unnecessary choice points. ^/2 : X ^ Goal. Existential quantification. ^/2 means "there exists an X such that Goal is true". This predicate is not really programmed into ^/2 at all: normally this predicate simply calls the given Goal, completely ignoring the value of X. ;/2 : Either ; Or. Disjunction. This predicate succeeds if either or both of its goals, Either and Or, are
succeed. Either call may itself be a conjunction or disjunction, or a simple goal. abolish/1 : abolish(Pred). Delete all occurences of the predicate Pred. Pred must be in the format name/arity. Ex. abolish(foo/1) abort/0 : abort. abort the current program append/3 : append(First, Second, Whole) if First and Second are instantiated, the Second list is appended to the end of the First list to give the Whole list append([a,b,c,d], [1,2,3,4], Whole ). <NextSol> arg/3 : arg(N, Term, Arg) Find the Nth argument of a term. assert/1 : assert(clause) add clause to the database
at the end of the sequence of clauses defining its predicate name. - You cannot assert a clause defined as built-in predicate. see also: asserta/1 asserta/1 : asserta(clause) add clause to the database
at the beginning of the sequence of clauses defining its predicate name. - You cannot assert a clause defined as built-in predicate. see also: assert/1 atom/1 : atom(Atom) Succeeds if Atom is currently instantiated to an atom. atomic/1 : atomic(Term) Succeeds if Term is currently instantiated to an integer, float, atom or string. It will fail if term is an unbounded variable or a compound term. call/1 : call(Call) Calls the goal Call. Succeeds if Call succeeds, and fails otherwise. callable/1 : collable(Term) Succeeds if Term is currently instantiated to a term that can be used as a query (i.e. a functor); otherwise it fails. compound/1 : compound(Term) Succeeds if Term is currently instantiated to a compund term. It wil fail if Term is an atom, integer, float, string or an unbounded variable. consult/1
: consult(filename) consult/1 loads the source file
specified by filename. If filename specify a
full path name the following apply: cons/1 : cons(Term) Succeeds if Term is currently instantiated to a list. date/3 : date3(Day, Month, Year) Succeeds if Day, Month and Year are uninstantiated and instatiates them to the current date. export/1 : :-export(predicate). Declares predicate as exported. It would be used only in a directive (see the section "Directives") to export a predicate defined in the current module. If it is used in the body of a clause it does nothing when called. extern/3 : extern(Pred, DBClassName, DBAttributes). Declares Pred as
an external database of clauses (i.e a database of clauses not stored in the
prolog database but in an external device such as JDBC database, text database
and so on). Es. extern(foo/3, "MyPackage.JDBCDatabase", "filename=foo.db+userid=me+pass=hello"). fail/0 Always fails. Can be used to force backtracking in a query. findall/3 : findall(Term, Call, List) Returns a List of all instances of
Term for which Call holds. Term may be any type of Prolog term. Call must be a goal to be
called. List will be unified with a list of instantiated copies of Term. float/1 : float(Term) Succeeds if Term is currently instantiated to a float number functor/1 : functor(Term) Succeeds if Term is currently instantiated to a functor functor/3 : functor(Term, Name, Arity) Succeeds if Term is a
functor with the specified Name and Arity. garbage_collect/0 : garbage_collect. Invokes the immediate garbage collection of the memory area. get/1 : get(Atom) Read an atom (as a string) from a prompt dialog and assign it to Atom. Atom must be an unbounded variable. integer/1 : integer(Term) Succeeds if Term is currently instantiated to an integer number. import/1 : :-import(predicate). Declares predicate as imported. It would be used only in a directive (see the section "Directives") to import a predicate defined in a module other then the current one. If it is used in the body of a clause it does nothing when called. is/2 : exp1 is exp2 Evaluates the
expression exp2 and unifies
the result with the value of the expression exp1. length/2 : length(List, Length) gets the length of a Prolog list If both Term and Length are unbound, Term will be unified, through backtracking, with a list of variables of infinite Length: listing/0 : listing Alwais succeeds showing all defined predicates. lst/1 : lst(Term) Succeeds if Term is currently instantiated to a list. member/2 : member(element, list) Succeeds
if element is a
member of the list list. member/3 : member(element, list, pos) Succeeds
if the element is in the list list at pos position. module/1 : :-module(moduleName). Defines the name of the current module. It would be used only in a directive (see the section "Directives") to hide predicates not declared as exported or imported by export/1 or import/1 . If it is used in the body of a clause it does nothing when called. ms/2 : ms(Call, Time) Runs the given Call and returns the Time in milliseconds (10 ^ -3 seconds) it took the goal to run. nil/3 : nil(Term) Succeeds if Term is instantiated to []. nl/0 : nl Start a new line on the current output stream. Writes a carriage return followed by line feed to the current stream. nonvarl/1 : nonvar(Term) Succeeds if Term is instantiated to a non variable term. not/1 : not predicate Logical not. Succeeds if predicate fails and vice versa see also: \+/1 notify/2 : notify(Exp, Term) Notify the JIPEventListeners that an Event occurred with ID in the expression Exp and term in Term number/1 : number(Term) Succeeds if Term is instantiated to a float or an integer number. phrase/2 : phrase(Phrase, List) Invokes the currently defined grammar
rules in order to parse a sequence of symbols. see also: phrase/3, Grammar Rule phrase3/ : phrase(Phrase, List, Rest) Invokes the currently defined grammar
rules in order to parse a sequence of symbols. see also: phrase/2, Grammar Rule repeat/0 : repeat Succeeds when called and on backtracking. Any calls which textually precede the repeat in the body of a clause will never be reached on backtracking. repeat/1 : repeat(Number) Succeeds when initially called, and succeeds for the given Number of times on backtracking. Any calls which precede the repeat in the body of a clause will not be reached until the repeat/1 predicate has been backtracked into the given Number of times. retract/1 : retract(clause) Searches for the first clause in the database that matches clause. If such a clause is found, it is deleted. Any variables in clause are bound as a result of the unification. This predicate is non-deterministic. On backtracking there is an attempt to find and delete another matching clause. This search always starts at the beginning of the list of clauses for the relation name of clause. So all clauses asserted between the retract and the redo of the call (even if added using asserta/1) are candidates for deletion on the redo. The call to retract/1 fails when there are no (more) clauses that match clause. - You cannot retract a clause defined as built-in predicate. retractall/1 : retractall(head) Deletes every clause in the database whose head matches head. Variables in head are left uninstantiated by the call. On backtracking there is no attempt to redo the call, even though matching clauses may have been asserted. - You cannot retract a clause defined as built-in predicate. reverse/2 : reverse(List, RevList) Checks or gets the reverse of a list. sort/2 : sort(List, SortedList) Each member of the list List is compared and sorted into ascending order according to the standard ordering of terms. The sorted copy of List is bound to the variable SortedList. statistics/0 : statistics Writes memory statistics: Total and Free memory. time/1 : time(Milliseconds) Succeeds if Milliseconds is an uninstatiated variable and instantiates it to current millisecond tick. time/4 : time(Hour, Minute, Second, Milliseconds) Succeeds if Hour, Minute, Second Milliseconds are uninstatiated variables and instantiates them to current time. unify/2 : unify(term1, term2) Succeeds if Term1 unify with Term2 see also: =/2 var/1 : var(Term). Succeeds if Term is instantiated to a variable. ver/0 : ver. Print the JIP version. wdialog/3 : wdialog(DialogName, Input, Output). Creates and shows a
custom Java™ dialog (derived from JIPDialog) which name is specified in DialogName,
passing it the Input term. When wdialog returns Output
is instantiated to the term returned by the method getOutput() of the
JIPDialog class. Es. See the section "How to write a custom Dialog" Note: public
MyDialog extend Dialog implements JIPDialog 2) The custom dialog should be modal, otherwise wdialog raises an error winputbox/2 : winputbox(Message, Output). Shows a dialog with the message contained in Message, an input field and an OK and Cancel buttons. If the user click on OK, when winputbox returns Output is instantiated to the string obtained from the text typed in the input field. wmsgbox/1 : wmsgbox(Message). Shows a dialog with the message contained in Message. write/1 : write(Term) Writes the term Term to the current output stream. winputbox/2 : winputbox(Message, Output). Shows a dialog with the message contained in Message, an input field and an OK and Cancel buttons. If the user click on OK, when winputbox returns Output is instantiated to the string obtained from the text typed in the input field. xcall/3 : xcall(ClassName, Input, Output). Create an instance of the extension class (a class that implements JIPXCall interface) specified in ClassName and calls the method invoke (JIPXCall.invoke) passing the Input argument. If the function succeeds (as returned by JIPXCall.succeeds) Output is instantiated to the term returned by the method JIPXCall.getOutput.
The developer can create your own extension class simply
implementing the JIPXClass interface Es. Note: public
MyXClass extend AnyClass implements JIPXCall xlisting/0 : xlisting Alwais succeeds showing all built-in predicates. |
| Home | Presentation | JIP Console | Intelligent Applets | API | Download | Contacts |
Copyright © Ugo Chirico
This page hosted by
Get your own Free Home Page