Versionsvergleich
Aus ProgrammingWiki
Vergleich: 2019-11-04T19:23:45+00:00 → 2019-11-04T19:27:08+00:00
folgende Predicates werden vom Prolog Interpreter von Haus aus unterstützt: | |
| − | == Built-in predicates |
| − | |
| − | === Control Constructs |
| + | == Built-in predicates == |
| + | |
| + | === Control Constructs === |
<pre> | |
!/0 – Cut. | |
,/2 – Conjunction. | |
->/2 – If-Then. | |
->;/3 – If-Then-Else. | |
;/2 – Disjunction. | |
call/1 – Invoke a callable term as a goal. | |
call/2 – Invoke a callable term as a goal with an extra argument. | |
call/3 – Invoke a callable term as a goal with two extra arguments. | |
call/4 – Invoke a callable term as a goal with three extra arguments. | |
call/5 – Invoke a callable term as a goal with four extra arguments. | |
call/6 – Invoke a callable term as a goal with five extra arguments. | |
call/7 – Invoke a callable term as a goal with six extra arguments. | |
call/8 – Invoke a callable term as a goal with seven extra arguments. | |
catch/3 – Enable recovery from exceptions. | |
fail/0 – Always fail. | |
false/0 – Always fail. | |
throw/1 – Raise an exception. | |
true/0 – Always succeed. | |
</pre> | |
| − | === Term Unification |
| + | === Term Unification === |
<pre> | |
=/2 – Unification. | |
subsumes_term/2 – Checks if general term can be made equivalent to specific one. | |
unify_with_occurs_check/2 – Check if two terms are unifiable. | |
\=/2 – Not unification. | |
</pre> | |
| − | === Clause Creation and Destruction |
| + | === Clause Creation and Destruction === |
<pre> | |
abolish/1 – Remove all the clauses of a predicate. | |
asserta/1 – Add term to the Prolog database. | |
assertz/1 – Add term to the Prolog database. | |
retract/1 – Delete term from Prolog database. | |
retractall/1 – Removes rules and clauses which unify with a term. | |
</pre> | |
| − | === Clause Retrieval and Information |
| + | === Clause Retrieval and Information === |
<pre> | |
clause/2 – Check the existence of rules. | |
current_predicate/1 – Check the existence of predicates. | |
</pre> | |
| − | === Term Creation and Decomposition |
| + | === Term Creation and Decomposition === |
<pre> | |
=../2 – Check the descomposition of a term. | |
arg/3 – Check the argument of a term in the nth position. | |
copy_term/2 – Copy one term without bounding the variables on it. | |
functor/3 – Check characteristics of a term. | |
term_variables/2 – Get variables of term. | |
</pre> | |
| − | === Term Comparison |
| + | === Term Comparison === |
<pre> | |
==/2 – Term identical. | |
@</2 – Term less than. | |
@=</2 – Term less than or equal to. | |
@>/2 – Term greater than. | |
@>=/2 – Term greater than or equal to. | |
compare/3 – Compare two terms according to order. | |
\==/2 – Term not identical. | |
</pre> | |
| − | === Type Testing |
| + | === Type Testing === |
<pre> | |
acyclic_term/1 – Check if term has no cycles. | |
atom/1 – Check if atom. | |
atomic/1 – Check if atom, integer or float. | |
callable/1 – Check if term is callable. | |
compound/1 – Check if compound. | |
float/1 – Check if float. | |
ground/1 – Check if term has no free variables. | |
integer/1 – Check if integer. | |
is_list/1 – Check if list. | |
nonvar/1 – Check if not variable. | |
number/1 – Check if integer or float. | |
var/1 – Check if variable. | |
</pre> | |
| − | === Logic and Control |
| + | === Logic and Control === |
<pre> | |
once/1 – Evaluate a term just once. | |
repeat/0 – Provide infinite choice points. | |
\+/1 – Not provable. | |
</pre> | |
| − | === Atom Processing |
| + | === Atom Processing === |
<pre> | |
atomic_list_concat/2 – Concatenate elements of list. | |
atomic_list_concat/3 – Concatenate elements of list with atom. | |
atom_chars/2 – Express an atom as a list of one character atoms. | |
atom_codes/2 – Express an atom as a list of character codes. | |
atom_concat/3 – Concatenate characters. | |
atom_length/2 – Length of an atom. | |
char_code/2 – Character code of an atom. | |
downcase_atom/2 – Turn atom into lowercase. | |
number_chars/2 – Express a number as a list of one character atoms. | |
number_codes/2 – Express a number as a list of number codes. | |
sub_atom/5 – Look for subatoms inside an atom. | |
upcase_atom/2 – Turn atom into uppercase. | |
</pre> | |
| − | === All Solutions |
| + | === All Solutions === |
<pre> | |
bagof/3 – Find all the values that would make a goal succeed and structure them. | |
findall/3 – Find all the values that would make a goal succeed. | |
forall/2 – Check an action for all alternative bindings. | |
setof/3 – Find all the values that would make a goal succeed and organize and order them. | |
</pre> | |
| − | === Arithmetic Evaluation |
| + | === Arithmetic Evaluation === |
<pre> | |
between/3 – Check if value is within a range of integers. | |
is/2 – Evaluate expression. | |
succ/2 – Return the successor of a positive number. | |
| − | Arithmetic Comparison |
| + | </pre> |
| + | === Arithmetic Comparison === |
| + | <pre> |
</2 – Arithmetic less than. | |
=:=/2 – Arithmetic equal. | |
=</2 – Arithmetic less than or equal to. | |
=\=/2 – Arithmetic not equal. | |
>/2 – Arithmetic greater than. | |
>=/2 – Arithmetic greater than or equal to. | |
</pre> | |
| − | === Implementation defined hooks |
| + | === Implementation defined hooks === |
<pre> | |
current_prolog_flag/2 – Check prolog flag and flag values. | |
halt/0 – Terminate a Prolog processor. | |
halt/1 – Terminate a Prolog processor and return message. | |
set_prolog_flag/2 – Set value of flag. | |
</pre> | |
| − | === Input and Output |
| + | === Input and Output === |
<pre> | |
current_op/3 – Check properties of operator. | |
op/3 – Alter the operator table. | |
</pre> | |
| − | === Stream Selection and Control |
| + | === Stream Selection and Control === |
<pre> | |
at_end_of_stream/0 – Check if last character from current input stream has been read. | |
at_end_of_stream/1 – Check if last character from a specific input stream has been read. | |
close/1 – Close a stream. | |
close/2 – Close a stream according to several options. | |
current_input/1 – Get the current input stream. | |
current_output/1 – Get the current output stream. | |
flush_output/0 – Flush output on current stream. | |
flush_output/1 – Flush output on specified stream. | |
open/3 – Open a source in a certain mode through a stream. | |
open/4 – Open a source in a certain mode through a stream according to some options. | |
set_input/1 – Set the current input stream. | |
set_output/1 – Set the current output stream. | |
set_stream_position/2 – Set the stream position. | |
stream_property/2 – Retrieve stream properties. | |
</pre> | |
| − | === Character Input/Output |
| + | === Character Input/Output === |
<pre> | |
get_char/1 – Get character from current input stream. | |
get_char/2 – Get character from input stream. | |
get_code/1 – Get character code from current input stream. | |
get_code/2 – Get character code from input stream. | |
nl/0 – Write new line character to current output stream. | |
nl/1 – Write new line character to output stream. | |
peek_char/1 – Read character from current input stream without removing it. | |
peek_char/2 – Read character from input stream without removing it. | |
peek_code/1 – Read character code from current input stream without removing it. | |
peek_code/2 – Read character code from input stream without removing it. | |
put_char/1 – Write character in current output stream. | |
put_char/2 – Write character in output stream. | |
put_code/1 – Write character code in current output stream. | |
put_code/2 – Write character code in output stream. | |
</pre> | |
| − | === Byte Input/Output |
| + | === Byte Input/Output === |
<pre> | |
get_byte/1 – Read byte from current input stream. | |
get_byte/2 – Read byte fom input stream. | |
peek_byte/1 – Read byte from current input stream without removing it. | |
peek_byte/2 – Read byte from input stream without removing it. | |
put_byte/1 – Write byte in current output stream. | |
put_byte/2 – Write byte in output stream. | |
</pre> | |
| − | === Term Input/Output |
| + | === Term Input/Output === |
<pre> | |
read/1 – Read Prolog term from current input stream. | |
read/2 – Read Prolog term from input stream. | |
read_term/2 – Read Prolog term from current input stream according to some options. | |
read_term/3 – Read Prolog term from input stream according to some options. | |
write/1 – Write Prolog term to current output stream. | |
write/2 – Write Prolog term to output stream. | |
writeq/1 – Write Prolog term to current output stream, quoting atoms if necessary. | |
writeq/2 – Write Prolog term to output stream, quoting atoms if necessary. | |
write_canonical/1 – Write Prolog term to current output stream in canonical form. | |
write_canonical/2 – Write Prolog term to output stream in canonical form. | |
write_term/2 – Write Prolog term into current output stream according to some options. | |
write_term/3 – Write Prolog term into output stream according to some options. | |
</pre> | |
| + | === List Manipulation === |
| + | <pre> |
| + | append/2 – Concatenate a list of lists. |
| + | append/3 – Join two lists. |
| + | drop/3 – Drop the first elements of a list. |
| + | keysort/2 – Check keys order. |
| + | last/2 – Last element of a list. |
| + | length/2 – Length of a list. |
| + | list_to_set/2 – Turn list into set. |
| + | max_list/2 – Largest element of a list. |
| + | member/2 – Check membership of element in list. |
| + | min_list/2 – Smallest element of a list. |
| + | msort/2 – Check standard order. |
| + | nth0/3 – Get the Nth element of a list. |
| + | nth0/4 – Get the Nth element of a list and the rest of elements on it. |
| + | nth1/3 – Get the Nth element of a list. |
| + | nth1/4 – Get the Nth element of a list and the rest of elements on it. |
| + | permutation/2 – Permutation of list. |
| + | prefix/2 – Get prefixes of list. |
| + | prod_list/2 – Product of the elements of a list. |
| + | replicate/3 – Generate list by replicating an element. |
| + | reverse/2 – Invert the order of the elements in a list. |
| + | select/3 – Check if two lists differ in one element. |
| + | sort/2 – Checks standard order. |
| + | take/3 – Retrieve first elements of a list. |
| + | </pre> |
| + | === List Higher Order === |
| + | <pre> |
| + | exclude/3 – Filter elements for which a goal fails. |
| + | foldl/4 – Reduce list to a single value. |
| + | include/3 – Filter elements for which a goal succeeds. |
| + | maplist/2 – Check if goal can be applied to a list. |
| + | maplist/3 – Check if goal can be applied to several lists. |
| + | maplist/4 – Check if goal can be applied to several lists. |
| + | maplist/5 – Check if goal can be applied to several lists. |
| + | maplist/6 – Check if goal can be applied to several lists. |
| + | maplist/7 – Check if goal can be applied to several lists. |
| + | maplist/8 – Check if goal can be applied to several lists. |
| + | </pre> |
| + | === Random Numbers === |
| + | <pre> |
| + | maybe/0 – Succeed or fail randomly. |
| + | maybe/1 – Succeed or fail with a certain probability. |
| + | random/1 – Generate random value. |
| + | random/3 – Generate random value in a range. |
| + | random_between/3 – Get random integer from range. |
| + | random_member/2 – Get random element of list. |
| + | random_permutation/2 – Rearrange list randomly. |
| + | </pre> |
| + | === Statistics === |
| + | <pre> |
| + | statistics/0 – Display system statistics. |
| + | statistics/2 – Display data of a single statistic. |
| + | time/1 – Execute goal and print metrics. |
| + | </pre> |