Previous Up Next

Appendix C  Core Predicates

This section lists essential ECLiPSe built-in and library predicates. These predicates are used in most applications, and should be well understood. There are more than 1000 other built-in and library predicates which are required for specific tasks only.

C.1  Modules

module directive
define a module
export directive
make predicates available outside a module
use_module directive
make predicates from other module available
lib directive
make predicates from library available
:
call a predicate from a particular module

C.2  Predicate definition

mode directive
define input/output modes for a predicate
comment directive
define comments about a module or a predicate

C.3  Control

,
conjunction, and
;
disjunction, or
->
implication, if-then-else together with disjunction
!
cut, remove choices
call/1
call argument as a predicate call
once/1
call argument as a predicate call, find one solution only
not/1
negation, fail if call to argument succeeds
true/0
always succeed, empty predicate definition
block/3
define a block in order to catch exceptions
exit_block/1
jump out of a block

C.3.1  Do Loops

do
general iteration operator
foreach
iterate over each element in a list
foreacharg
iterate over each argument of a term
fromto
accumulator argument
for
iterate over all integers between two bounds
param
declare parameter variables which are passed into the do-loop

C.4  I/O

exists/1
succeeds if a file exists
open/3
open a file or a string as a stream
close/1
close a stream
write/2
write some term to a stream
nl/1
write a new-line to a stream
writeln/2
write a term to a stream, followed by a new-line
writeq/2
write a term in canoncial form, so that if can be read back
read/2
read a term from a stream
read_string/4
read a string from a stream
concat_string/2
build a string from a list of components
phrase/3
call DCG analyzer
read_exdr/2
read a term from a file in EXDR format
write_exdr/2
write a term to a file in EXDR format
flush/1
flush an output stream

C.5  Arrays

dim/2
define an array; can also be used to find size of an array
subscript/3
get an element of an array

C.6  Hash Tables

hash_create/1
create a hash table
hash_add/3
add an item to a hash table
hash_find/3
find if an item is in a hash table

C.7  Arithmetic

is/2
evaluate term
=:= /2
evaluate two terms and compare for equality
=\= /2
evaluate two terms and compare for disequality
>/2
evaluate two terms and compare for inequality
>= /2
evaluate two terms and compare for inequality
</2
evaluate two terms and compare for inequality
=</2
evaluate two terms and compare for inequality

C.8  Terms and structures

struct/1
define named structure
with
access element(s) in named structure
of
find argument position in named structure
functor/3
define/analyze term for functor and arity
arg/3
access argument of term
compare/3
compare two terms for lexicographical order
= /2
two terms can be unified
== /2
two terms are identical
\= /2
two terms cannot be unified
number/1
argument is a number
integer/1
argument is an integer
atom/1
argument is an atom
var/1
argument is a variable
string/1
argument is a string
real/1
argument is a float
compound/1
argument is a term

C.9  List Handling

sort/2/4
sort a list
memberchk/2
check if an item occurs in a list
length/2
find the length of a list or create a list with given length
findall/3
find all solutions to a query and return a list of all answers

Previous Up Next