Index

—8—

8086, 384

80x86 processor family, 442

—A—

abs, 191

absolute, 191

absolute values, 191

Abstract, 212

access

    error message files, 246

    external database via B+ trees, 343

    hardware, 383

    memory, 386

    OS, 373

access modes, 291

accessmode, 358

accessmode, 325

actions

    post- and pre-, 116

adding facts at run time, 174

addition, 186

adventure game, 396

alignment

    memory, 426, 449

    databases and pipes, 362, 450

alternate solutions, 61

alternative, 126

alternatives to file domains, 415

anonymous variables, 25, 425

append, 160, 223, 403

appending

    lists, 159

approximate, 196

arc tangent, 192

arctan, 192

arguments, 11, 22

arity and, 50

    compound data objects, 98

    flow pattern, 216

    input, 216

    known, 216

    multiple-type, 110

    output, 216

    reference domain, 220

    typing in predicate declarations, 47

arguments:, 60

arithmetic, 186

    expressions, 186

    comparing, 195

    integer and real, 191

    operations, 186

    order of evaluation, 187

arities, 418

arity, 50

arrays

    code, 432

    internal, 432

ASCII, 96

assembler

    routines

    calling, 460

assert, 174

asserta, 174

assertz, 174

assignment statements, 195

atoms, 97

attributes, 291

automatic type conversion, 51, 97, 222, 316

—B—

B+ trees, 321, 339

bt_copyselector, 341

    closing, 341

    creating, 340

    deleting, 341

    duplicate keys, 340

    internal pointer, 342

    internal pointers, 354

    key length, 339

    multiple scans, 340

    order B+ trees

    pages, 339

    statistics, 341

    updating, 342

backslash, 421

backtrack point

    removing, 259

backtracking, 61, 114

basic principles, 68

    point, 62

    preventing with the cut, 78

basic

    concepts of Prolog, 10

    program sections, 35

    string-handling procedures, 307

beep, 379

bgi_ilist, 416

bgidriver compiler directive, 431

bgifont compiler directive, 431

binary

    domain, 238

    search trees, 139

    trees

        reference domains and, 224

binary terms

accessing, 240

comparing, 241

creating, 239

size of, 240

unifying, 241

binding

flowpatternstopredicatecalls, 216

bios, 384

bitand, 381

bitleft, 382

bit-level operations, 381

bitnot, 381

bitor, 382

bitright, 383

bitxor, 301, 382

bound variables, 425

break, 251

Break Check menu item, 435

breakpressed, 252

bt_close, 341

bt_copyselector, 341

B+ trees, 341

bt_create, 340

bt_delete, 341

bt_open, 341

bt_selector, 221, 325, 416

bt_statistics, 341

bt_updated, 361

byte, 44, 424

—C—

C

interface, 441

lists, 455

passing lists to, 449

passing structures to, 448

routines

calling, 444

calling conventions, 442

calls

deterministic, 77

non-deterministic, 77

carriage return, 421

case conversion, 314

cast, 260

chain_delete, 333

chain_first, 334

chain_inserta, 332

chain_insertafter, 333

chain_insertz, 332

chain_last, 334

chain_next, 334

chain_prev, 334

chain_terms, 333

chains

deleting, 333

inserting terms in, 332

manipulating, 332

names of terms in, 333

of terms, 323

char, 45, 96, 421

char_int, 313

character fonts

linking, 431

characters, 96, 199

comparing, 199

converting to integers, 313

converting to strings, 314

characters:, 96, 199

check_determ, 126

check_determ compiler directive, 260, 265, 419, 431, 437

Class, 202, 203, 204, 208

classes, 200

clauses, 18

head, 421

Horn, 10

nondeterministic, 431

non-deterministic, 265

section, 36, 421

clauses:, 162

closefile, 282

closing

B+ trees, 341

external database, 330

files, 281

code compiler directive, 432

coercion

type], 51

comline, 376

command line, 376

comments, 29

comparing, 186

arithmetic expressions, 195

characters, 199

strings, 199

symbols, 199

compilation

conditional, 429

compiler, 126

compiler directives, 54, 431

bgidriver, 431

bgifont, 431

check_determ, 260, 265, 419

code, 432

config, 433

determ, 173

diagnostics, 433

errorlevel, 434

include, 54, 438

nonbreak, 435

nowarnings, 436

struct, 448

composebinary, 240

compound

data objects, 98

lists, 164

mixed-domain declarations, 110

objects, 425

declaring domains, 105

unification, 99

compound flow pattern, 217

compound:, 148

compund object, 425

concat, 310

concatenation

strings, 308, 310

conditional compilation, 429

conditional:, 51

config compiler directive, 433

CONFIG.SYS, 327

configuration file, 433

constants

declaring, 53

predefined, 428

section, 53, 427

Constructors, 210

consult, 175, 249

consulterror, 249

controlling the flow analysis, 219

conversion

case, 314

character to integer, 313

integer to character, 313

integer to string, 314

numbers, 194

real to string, 314

single character to string, 314

string to character, 314

string to integer, 314

string to real, 314

type, 51

conversion of types, 260

converting domains, 222

copyfile, 290

copying external databases, 328

cos, 192

cosine, 192

counters, 120

counting list elements, 152

cpunters, 128

criticalerror, 257

cursor predicate, 216

cutbacktrack, 259

cuts, 78, 126

as goto, 90

determinism and, 81

dynamic, 259

setting, 432

static, 259

using, 78

—D—

data

objects

compound, 98

security, 330

structures

recursive], 132

types

trees, 133

database

global, 439

internal, 171

declaring, 171

updating, 173

using, 172

predicates

restrictions, 172

reference numbers, 325, 334

section, 52, 171, 420

database:, 52

databases

test of system (program), 335

date, 102, 375

db_begintransaction, 359, 361, 370

db_btrees, 331

db_chains, 331

db_close, 330

db_copy, 328

db_create, 327

db_delete, 330

db_endtransaction, 359, 361

db_flush, 329

db_garbagecollect, 330

db_loadems, 329

db_open, 328, 360

db_openinvalid, 329

db_reuserefs, 326

db_saveems, 329

db_selector, 221, 325, 416

db_setretry, 362

db_statistics, 331

db_updated, 361

dbasedom, 172, 416

declarations

accessmode, 358

as external name, 446

B+ tree selectors, 325

compound mixed-domain, 110

constants, 427

database selectors, 325

denymode, 358

different domains, 414

domain, 39

domains as reference, 220

domains of compound objects, 105

facts section, 171

functions, 419

global, 438

lists, 148

local, 439

predicate domains, 417

predicates, 36

predicates as deterministic, 419

reference domains, 417

typing arguments, 47

declarative language, 10

default error routines, 257

deletefile, 289

deleting

B+ trees, 341

chains, 333

external database, 330

terms, 335

denymode, 325, 358

depth-first search, 136

Derived, 213

Destroying, 204

Destructors, 210

determ, 432

determinism, 77

cut and, 81

vs. non-determinism, 265

deterministic predicates, 419

diagnostics compiler directive, 433

difference lists, 165

difftime, 378

dirclose, 297

dirfiles, 298

dirmatch, 297

diropen, 296

disabling breaks, 251

discriminant, 196

diskspace, 380

displaying external database contents, 347

div, 191

dividing

words into syllables, 402

division, 186

domains

binary, 238

compound mixed, 110

compound object, 415

converting reference, 222

db_selector, 323

dbasedom, 172

declarations, 39

declaring, 414

declaring as reference, 220

external databases, 325

file, 415

file, 284

global, 439

internal, 420

list, 414

predefined, 416

predicate, 417

ref, 326

reference, 220, 417

reg, 384

section, 413

shortening declarations, 416

specially handled, 416

standard, 414

user-defined, 418, 425

DOS

critical error, 257

double quotation marks, 422

drivers

linking, 431

dumpDba, 356

dumping external databases to text file, 356

duplettes, 340

duplicate keys

in B+ trees, 340

dword, 44, 424

dynamic cutting, 259

dynamic memory allocation, 454

—E—

elements of the language, 411

elsedef, 429

enabling breaks, 251

Encapsulation, 200

enddef, 429

environment symbols, 375

envsymbol, 375

eof, 286

equal

predicate, 195

sign

unifying compound objects, 99

equality, 195

equality:, 196

erroneous, 230

Erroneous, 419

error

memory overflow, 224

error reporting, 247

errorcodes, 244

reserved, 244

errorlevel, 247

errorlevel compiler directive, 434

errormsg, 246

errors

constant definition recursion, 428

constant identifier declarations, 428

consult, 249

control in EXE files, 257

readterm, 250

reporting

at run time, 247

run-time, 247, 434

term reader, 249

trapping, 244

escape character, 421

example Prolog programs, 389

EXE files

error control in, 257

existdir

example, 297

existfile, 288

exit, 245

exp, 193

expressions, 186

order of evaluation, 187

external, 320

name

declaration, 446

predicates

declaring, 442

external databases

accessing via B+ trees, 343

accessmode, 358

B+ tree names, 331

chain names, 331

closing, 330

copying, 328

creating, 327

deleting, 330

deleting chains, 333

denymode, 358

displaying contents of, 347

domains, 325

dumping to text file, 356

filesharing, 359, 370

file-sharing, 358

flushing, 329

index to, 339

inserting terms in, 332

invalid, 329

location of, 327

locking of, 360, 364, 370

log file, 349

merging free space, 330

moving, 328

non-breakdown, 349

opening, 328

programming, 345

RAM requirements, 320

reopening, 359

scanning through, 346

selectors, 322

sharemode, 359

statistics, 331

structure of, 321

system, 320

transactions, 359

updating, 350

external program, 373

—F—

factorials:, 120

facts, 11, 420, 421

adding at run time, 174

loading from files at run time, 175

removing, 176, 178

saving at run time, 181

section, 52

facts databases

using, 172

facts sections

databases

updating, 173

facts:, 60

fail, 76, 117

failure, 230

Failure, 419

FAR subroutines, 442

file attributes, 291

file_bin, 279

file_str, 276

fileattrib, 300

fileerror, 258

filemode, 282

filenameext, 295

filenamepath, 294

filepos, 285

files

attributes, 290

closing, 281

domain, 415

domains, 416

dumped (external databases), 356

error message, 246

external databases

file-sharing, 358

log (external databases), 349

object, 441

opening, 281

symbolic file names, 422

filesharing, 370

predicates, 360

transaction, 359

findall, 162

finding

all solutions at once, 162

flag, 384

floating-point numbers, 422

flow pattern, 31, 161, 216

compound, 217

non-existent, 219

flush, 288

flushing an external database, 329

fonts

linking, 431

Formal, 215

format, 311

formatted output

examples, 273

to string variable, 311

formatting arguments into a string, 307

free, 59, 454

free variables, 425

frontchar, 307

frontstr, 309

fronttoken, 308

functions

declaring, 419

return values, 227

sizeof, 453

functorless terms, 448

functors, 98, 415

—G—

games

adventures in a cave, 396

Towers of Hanoi, 400

getbacktrack, 259

getbinarysize, 240

getentry

binary access, 240

global

databases, 439

declarations, 438

domains, 439

predicates, 439

stack, 437

global sections, 54

goal trees, 67

goals, 26

goals:, 43, 59

goto:, 90

graphics

linking drivers, 431

linking fonts, 431

—H—

hardware simulation, 398

head, 60

head of clause, 421

heap

allocation from C, 454

heap compiler directive, 435

Heap menu item, 435

heapsize, 380

hexadecimal numbers, 186

Horn clauses, 10

hypertext, 146

—I—

I/O

ports, 386

redirecting, 284

Identity, 201

IEEE standard format, 97

if/then, 51

ifdef, 429

ifndef, 429

IMPLEMENT, 202

in B+ trees

names, 331

in chains

names, 331

in_file, 327

in_memory, 327

include compiler directive, 54, 438

include file

error.con, 244

including files in your program, 430

index

to external databases, 339

inference engine, 10, 389

infix

predicate, 99

infix:, 195

Inheritance, 201

input

argument, 31

arguments, 216

parameters, 443

redirecting, 284

input:, 161

inserting terms in chains, 332

instantiating reference variables, 221

integer, 44, 424

integers

arithmetic, 191

converting to characters, 313

converting to strings, 314

division, 191

random, 189

interchangeability of unknowns, 155

interfacing with other languages, 441

intermediate, 120

internal

databases, 171

using, 172

facts-section, 171

goals, 413

pointer

B+ trees, 342

string address, 385

system time clock, 375

internal:, 52, 436

invalid external databases, 329

invertible, 162

isname, 310

IXREF statistics

B+ trees, 341

—K—

key_current, 343

key_delete, 342

key_first, 342

key_insert, 342

key_last, 342

key_next, 343

key_prev, 343

key_search, 342

keyboard, 416

keywords, 412

—L—

large, 438

last-call, 122

lasterror, 248

length

of a string, 310

length:, 152

less than, 195

linked lists, 449

listdba, 347

lists, 111, 147

appending, 159

as compound objects, 426

compound, 164

counting elements, 152

declaring, 148

defined, 147

difference, 165

domains, 414

handling, 455

length, 152

linked, 449

membership, 157

mixed types, 426

passing to C, 449

processing, 149

recursion and, 147

using, 150

lists:, 147, 150

ln, 193

loading

facts from a file at run time, 175

log, 193

log file

external databases, 349

logarithm, 193

logic program

defined, 10

logical

AND, 381

circuit, 398

inference, 10

NOT, 381

OR, 382

XOR, 382

long, 43, 424

loop variables, 128

loops

backtracking, 118

lowercase

in names, 411

low-level support, 383

—M—

macro definition, 427

makebinary, 239

malloc, 454

manipulation

chains, 332

external databases, 326

terms (external database, 334

marktime, 377

matching, 30, 58

mathematical, 188

member, 158, 223, 418

membyte, 386

memdword, 386

memory

access, 386

alignment, 426, 449

databases and pipes, 362, 450

allocation, 451

dynamic, 454

freeing, 437

management, 437

overflow error, 224

regaining (external databases), 330

memword, 386

menus:, 54

merging free space, 330

mod, 191

modes

access, 291

sharing, 291

modular arithmetic, 191

modular programming, 438

modules, 438

moving external databases, 328

Multi, 419

multiple

arity, 50

solutions, 77

multiple-type arguments, 110

multiplication, 186

multitasking, 358

mykey_next, 354

mykey_prev, 354

mykey_search, 354

—N—

N Queens problem, 405

names, 411

external database predicates, 321

predicates, 37

redefining, 428

restrictions in, 411

terms in chains, 333

valid, 310

naming conventions, 443

extended database predicates, 321

natural

logarithm, 193

NEAR subroutines, 442

newline, 421

nl, 267

nobreak compiler directive, 435

nondeterm, 432

non-determinism, 77

non-determinism vs. determinism, 265

non-deterministic clause warning, 431

nondeterministic predicates, 419

not, 82, 389

nowarnings compiler directive, 436

numbers, 97

converting, 194

hexadecimal, 186

octal, 186

—O—

object files, 441

objects, 11, 200

compound, 425

octal numbers, 186

openappend, 282

openfile, 292

opening

B+ trees, 341

external databases, 328

files, 281

invalid external database, 329

openmodify, 282

openread, 144, 281

openwrite, 144, 281

operands, 186

operations, 186

bit-level, 381

operators, 186

precedence of, 187

relational, 195

order

B+ trees, 339

of evaluation, 187

OS

accessing from applications, 373

osversion, 379

output

argument, 31

arguments, 216

diagnostic, 433

echoing to file or printer, 436

formatted to string variable, 311

parameters, 443

redirecting, 284

output:, 161

overflow

memory, 224

—P—

parameter-pushing, 442

parameters

input, 443

output, 443

parser, 316

parsing, 168

by different lists, 165

pathname

in include files, 430

pattern matcher, 10

peeking, 386

place, 221, 325, 416

pointers

B+ trees (internal), 354

stack, 445

poking, 386

port_byte, 386

post-actions, 116

pre-actions, 116

predefined

domains, 416

file names, 416

predefined constants, 428

predicate logic, 10

predicates, 22

arity, 50, 418

as arguments, 232

C functions, 444

declarations

typing arguments in, 47

declaring as deterministic, 419

equal, 195

external, 442

flow variants, 443

global, 439

implementing in other languages, 442

infix, 99

multiple declarations, 418

names, 37

number of arguments, 50

section, 36, 418

specially handled, 412

predicates:, 36

preventing backtracking, 78

Printer Menu in EXE File menu item, 436

printermenu compiler directive, 436

procedural perspective, 87

procedure parameters, 232

procedures, 12

program planning routes, 394

program sections, 412

program structure

restrictions on, 413

programming

efficiency, 261

external databases, 345

modular, 438

style, 261

system-level, 373

programs

different versions of same, 429

large, 438

sections, 35

clauses, 36

constants, 53

domains, 39

facts, 52

global, 54

predicates, 36

stand-alone, 413

programs:, 10, 43

project compiler directive, 436

projects, 438

error level in, 435

Prolog

example programs, 389

fundamentals, 10

objects, 11

predicate logic syntax, 10

procedural perspective, 87

relations, 11

Protected, 213

ptr_dword, 385

—Q—

quadratic, 196

queries, 13, 26

questions, 13

quotation marks, 421

—R—

random, 189

random numbers

generating, 189

initializing, 190

randominit, 190

readblock, 279

readchar, 276

readdevice, 144, 283

reading

from I/O port, 386

user-edited files, 249

readint, 275

readln, 275

readreal, 276

readterm, 249, 276, 301

readtermerror, 250

real, 45, 97

arithmetic, 191

converting to string, 314

random, 189

recursion, 120, 147

from a procedural viewpoint, 160

lists and, 147

repitition and, 114

recursive

data structures, 132

procedures, 120

recursive:, 148

red cuts, 78

ref, 325, 416

ref_term, 335

reference

domains, 220, 417

binary trees and, 224

sorting with, 225

trail array and, 221

numbers, 325

variable, 220

variables, 221

Reference, 211

reg, 221, 416

reg domain, 384

register:, 384

registers

preserving, 458, 462

relational, 172

relational operators, 195

relations, 11, 22

removing

backtrack points, 259

facts at run time, 176

several facts at once, 178

renamefile, 290

repeat, 118

repeat...fail, 438

repetition

recursion and, 114

repetitive processes, 114

replacing terms, 334

reporting errors at run time, 247

reserved words, 412

restrictions

names, 411

program structure, 413

symbolic constants, 428

restrictions to using database predicates, 172

retract, 176

retractall, 178

RetryCount, 362

return values, 419

registers for, 443

return values from functions, 227

round, 193

rounding, 191, 193

route planning

example, 394

rules, 11, 12, 421

as procedures, 87

syntax, 50

using like case statements, 88

rules:, 60

run-time

error reporting, 434

run-time errors, 244, 247

—S—

samekey_next, 355

samekey_prev, 355

save, 181, 183, 249

saving

facts at run time, 181

scanner, 315

scanning, 168

B+ trees, 340

external databases, 346

scope

constant identifiers, 428

predicates, 433

screen, 416

search

database for record, 339

searchchar, 312

searchfile, 289

searchstring, 313

selectors

external databases, 322

sentence structure, 109

separators:, 150

setentry

binary access, 240

setting cuts, 432

sharing modes, 291

short, 43, 424

signal, 252

signals

enabling and disabling, 251

signed:, 44

simple constants, 421

sin, 192

sine, 192

single, 230

single solutions, 77

sizeof function, 453

sleep, 377

SleepPeriod, 362

solutions

controlling the search, 75

finding all at once, 162

multiple, 77

single, 77

solutions:, 126

sorting

tree-based, 141

with reference domains, 225

sound, 379

sqrt, 193

square roots, 191, 193

stack

pointer, 445

standard

domains, 414, 421

object files, 441

Static, 208

statistics

external databases, 331

stderr, 416

stdin, 416

stdout, 416

storage (predicate), 380

str_char, 314

str_int, 314

str_len, 310

str_real, 314

string, 46

string-handling, 307

strings, 97, 199, 422

blank spaces, 310

building, 307

comparing, 199

comparison, 199

concatenation, 308, 310

converting to other domains, 314

converting to term, 315

creating blank, 307

dividing, 307

internal address, 385

length, 310

manipulations, 307

parsing, 316

returning, 307

verifying, 307

length, 307

struct compiler directive, 448

structure

data, 425

external databases, 321, 356

programs, 413

structures

passing to C, 448

style

programming, 261

subchar, 311

subcomponents, 425

of functors, 415

subgoals:, 61, 82

substring, 311

subtraction, 186

symbol, 46, 422

symbolic

constants, 53

symbolic constants, 411, 422

restrictions on, 428

symbolic file names, 422

symbols, 97, 199

comparing, 199

syntax

predicate logic, 10

rules, 50

syspath, 376

system, 373

system-level programming, 373

—T—

tab, 421

tail recursion, 154

optimization, 122

tan, 192

tangent, 188, 192

telephone directory, 48

term

converting to string, 315

location in chain, 325

term reader

handling errors from, 249

term_bin, 243

term_delete, 335

term_replace, 334

term_str, 315

termination, 43

terms, 425

alignment, 426, 449

binary conversion of, 242

chains of, 323

deleting, 335

functorless, 448

manipulating, 334

reference number, 335

replacing, 334

tests

external database system external, 335

text

files

external databases dump, 356

This, 211

time, 375

timeout, 377

totals, 120

trail

array

reference domains and, 221

transcendental functions, 191

trap, 245

traversing trees, 135

tree-based sorting, 141

trees

as data type, 133

binary search, 139

creating, 137

goal, 67

traversing, 135

trigonometry, 191

trunc, 194

truncation, 191, 194

type

coercion, 51

conversion, 51, 313

automatic, 316

type conversion, 260

type implementation, 447

type variants, 418

type-checking, 177

typing arguments in predicate declarations, 47

—U—

ulong, 43, 424

unbound variables, 417

underscore symbol, 26

unification, 58, 425

of compound objects, 99

unification:, 131

unsigned, 44, 424

unsigned:, 44

updating

B+ trees, 342

external databases, 350

facts section, 173

upper_lower, 314

uppercase

in names, 411

user-defined

domains, 425

error routines, 257

ushort, 43, 424

—V—

value, 186

Variable Used Once menu item, 436

variables, 13, 16, 22, 425

anonymous, 25, 425

bound, 425

constants and, 428

efficient programming with, 261

free, 425

reference, 220

unbound, 417

variables:, 59

verifying the length of a string, 307

version

OS, 379

Virtual, 206

Visual Prolog

arithmetic, 186

external database, 320

handling strings, 307

strings in, 307

Visual Prolog

internal facts section, 171

program sections, 35

—W—

word, 44, 424

write, 267

write_a_list, 398

writeblock, 279

writedevice, 144, 283

writef, 272

writing

to I/O port, 386