Control predicates:
op defines an operator
true always succeeds
fail always fails
once executes a goal,
but it is not re-executable
call starts a goal
! (cut) partially restricts the backtracking
; (or) executes the left goal and if
fails or on Next Answer executes the right one
-> (if-then-else) if the
most left goal succeeds then executes the next goal, if it fails then executes
last goal.
not Prolog negation
functor checks a functor's name
and arity
findall makes a list of all success
Strawberry functions:
of that X which satisfy Y
count_successes count the successes
of a goal
function if then else function
if-then-else
list_length returns the length of a
list
true_value returns one or zero
min returns the minimum
max returns the maximum
Loops predicates:
repeat always tries to
get one more answer
for doing a loop
Execution control:
trace switches program execution to trace mode
terminate terminates the program and displays
a message
execute starts the execution of other program
(usually *.EXE)
shell_execute opens a file by using
it extension.
not_deeper_than temporally restricts
the stack size
Input and Output predicates:
read reads a term using a dialog box
write writes a term
writeq writes a term (without calculating
it)
nl prints a new line
print_file prints formatted file
print_string prints formatted string
Dialogs:
message creates a message dialog
box
yes_no opens a dialog box with
a yes-no question to be answered
Knowledge base manipulation:
assert
appends a clause to the run-time database
assert_in
appends a clause both to the run-time database and to the source
asserta
appends a clause to the run-time database (in the beginning)
asserta_in
appends a clause both to the run-time database and to the source (in the
beginning)
retract retracts a clause from
the run-time database
retract_in retracts a clause
both from the run-time database and from the source
retractall retracts all occurrences
of a clause from the run-time database
set retracts a clause and assert another one
in place of it
Direct Database Manipulation:
on_the_last_step which was the
fact used in the last unification
the_head_of returns the head
of the clause by its consecutive number
set_at changes the fact which
has this consecutive number
retract_at retracts the fact
which has this consecutive number
modify_at modifies the fact which
has this consecutive number
File Manipulation:
open opens a file
close closes a file
writef writes the string in a file
readf reads a string from a file
readln reads a line from a file
feof checks for a end-of-file
set_current_directory sets the
current directory.
get_current_directory retrieves
the current directory.
create_directory creates a new
directory.
remove_directory removes a directory.
delete_file deletes a file.
move_file moves a file to a new
location
ftruncate truncates a file
get gets a byte, integer or float from a file
put puts a byte, integer or float in to a file
set_file_pos sets the file pointer
get_file_pos returns the position of the
file pointer
select_file invokes an open/save file
dialog box
Time:
chronometer gets time intervals in milliseconds
get_time gets current time
get_date gets current date
wait waits time interval
Special effects:
=.. makes functor and arguments as a list
beep produces a short beep
cursor sets the cursor to one of the standard
cursors
OLE and ActiveX:
server opens an OLE server
server2 opens an OLE server which listen for events
close close OLE server
. (point) sets and gets property, invokes method
embed_server embeds an ActiveX control
raise_event sends information from the sever back to the client
E-mail control:
logon Log on as an e-mail user
logoff Log off as an e-mail user
send_mail send an e-mail letter
read_new_mail reads e-mail letters
s_mail sends mail (ONLY for UNIX)
Prolog CGI Scripts
getenv returns the environment value
get_environment_arg returns a part of a string
get_html_form returns a form field
set_content_type sets the content type
set_cookie sets a cookie on the client's browser
get_program_argument returns
the program argument passed from the command line
url_encode encodes into the URL format
Sockets support
socket returns a client socket
read_sock reads a string from the socket
write_sock writes the string in the socket
get_client gets a client socket of the
remote host
server_socket creates a server socket
SQL support
mysql_connect opens a connection to MYSQL server
mysql_select_db selects the database from MYSQL
server
mysql_query executes the Query on selected database
on the MYSQL server
mysql_store_result stores the result from the
execution of a query
mysql_fetch_row returns the next row from the
MYSQL result
mysql_num_fields returns the number of the fields
from returned MYSQL result
field returns a field from a row
mysql_free_result frees the MYSQL result
mysql_eof checks if the end of the result is
reached
close closes the MYSQL connection