next up previous index
Next: Syntax Up: Libraries Previous: SICStus Prolog Compatibility Package   Index

Subsections


Utility Libraries

These libraries contain various predicates which were not included into ECLiPSe built-in predicates but which are often useful for the user.

Util

The library is loaded using
:- lib(util).
and it current contains the following predicates:

add_path(+Directory)
The argument must be a string which is the name of a directory. This directory will be added at the beginning of the library path.

add_suffix(+Suffix)
The argument must be a string which denotes a file name suffix that will be added at the beginning of the prolog_suffix list.

between(+From, +To, ?I)
Succeeds if From and To are integers and I unifies with a number between the two. On backtracking it generates all values for I starting from From onwards.

compiled
List all currently compiled files and indicate if they have been modified since they were compiled.

list_error(+String, -ErrNo, -ErrMsg)
Find the event number whose message contains the specified substring.

ptags_all
Make a ptags file for all .pl files in the current directory.

read_line(-String)
Defined as
read_line(String) :-
        read_string(input, "\n", Length, String).
It reads a line from the input stream into a string.

read_line(+Stream, -String)
Like the previous but reads from a specified stream.

stream(+Stream)
List all information about the specified I/O stream.

streams
List all currently opened streams.

time(+Goal)
Call the goal Goal, measure its runtime (cputime) and print the result after success or failure.

write_history
Writes the current history into the .eclipse_history file.

Define

This library allows to define macro transformation similar to the #define command of the C preprocessor.

Numbervars

Implements the numbervars(Term, From, To) predicate of C-Prolog. Term is any term, From and To are integer numbers. All variables in Term are instantiated to terms of the form
$VAR(N)
where N is an integer number. The first encountered variable will be coded by the number From, on exit To is instantiated to the next unused number.

This predicate can thus be used to encode nonground term using a ground representation. Note that metaterms can be used for the same purpose, but their use is both more efficient and more general, because the variables are not actually instantiated and so they can be used again as variables when needed.


Apply

Implements the apply/2 predicate.


Lips

Measure the system's speed in logical inferences per second, using the infamous naive reverse program.


Anti_unify

Defines the predicate anti_unify/3 which computes the least common generalisation of two terms.


Spell

The effect of loading this library is to modify the event handler for calling an undefined procedure. A spelling correction algorithm is used to see if the cause was a misspelling of an existing predicate.


Rationals

This library should be loaded when working with rational arithmetic. It defines macros to accept and print rationals in the form Num/Den (in addition to the standard syntax Num_Den). Also, it sets the global flag prefer_rationals, so that the arithmetic division function / yields a rational rather than a floating point result.


next up previous index
Next: Syntax Up: Libraries Previous: SICStus Prolog Compatibility Package   Index

1999-08-06