YAP 7.1.0
YAP Library

Detailed Description

the library_directory path (set by the LIBDIR variable in the Makefile for YAP) Several files in the library are originally from the public-domain Edinburgh Prolog library

Modules

 Extension of arg/3
 

 
 Association Maps
 The following association list manipulation predicates are available once included with the use_module(library(assoc)) command.
 
 SWI-Like autoloader
 
 AVL Trees
 Supports constructing AVL trees.
 
 Backtrackable Hash Tables
 

 
 Block Diagram
 This library provides a way of visualizing a prolog program using modules with blocks.
 
 Concurrent Alarms
 This library provides a concurrent signals.
 
 Operations on Sequences of Codes.
 Term to sequence of codes conversion, mostly replaced by engine code.
 
 Clause Manipulation
 This library supports a number of useful utilities that come up over and over again when manipulating Prolog programs.
 
 Old Call Cleanup
 % call_cleanup/1 and call_cleanup/2 allow predicates to register code for execution after the call is finished
 
 Co-Logic Programming
 

 
 Non-backtrackable queues in YAP.
 A library to implement queues of NB Terms.
 
 Memory Usage in Prolog Data-Base
 This library provides a set of utilities for studying memory usage in YAP.
 
 Directed Graphs
 The following graph manipulation routines use the red-black tree library to try to avoid linear-time scans of the graph for all graph operations.
 
 Exo Intervals
 This package assumes you use exo-compilation, that is, that you loaded the pedicate using the exo option to load_files/2 , In this case, YAP includes a package for improved search on intervals of integers.
 
 Flag Manipulation in Prolog
 
  • Routines to manipulate flags: they allow defining, set, resetting

 
 Generate a new symbol.
 
  • Predicates to create new atoms based on the prefix Atom

 
 Heaps
 A heap is a labelled binary tree where the key of each node is less than or equal to the keys of its sons.
 
 Tries for ILP
 
 MPI Interface
 This library provides a set of utilities for interfacing with LAM MPI.
 
 Line Manipulation Utilities
 This package provides a set of useful predicates to manipulate sequences of characters codes, usually first read in as a line.
 
 Apply a predicate to all arguments of a term
 
 Map List and Term Operations
 
  • This library provides a set of utilities for applying a predicate to all elements of a list

 
 MATLAB Package Interface
 The MathWorks MATLAB is a widely used package for array processing.
 
 Matrix Library
 This package provides a fast implementation of multi-dimensional matrices of integers and floats.
 
 Non-Backtrackable Data Structures
 The following routines implement well-known data-structures using global non-backtrackable variables (implemented on the Prolog stack)
 
 Ordered Sets
 The following ordered set manipulation routines are available once included with the use_module(library(ordsets)) command.
 
 Automating test generation
 This library aims at facilitating test generation in a logic program, namely when interfacing to foreign code.
 
 Queues
 The following queue manipulation routines are available once included with the use_module(library(queues)) command.
 
 Random Number Generator
 Since YAP-4.3.19 YAP uses the O'Keefe public-domain algorithm, based on the "Applied Statistics" algorithm AS183.
 
 Red-Black Trees
 

 
 Reading Lines and Files
 Read full lines and a full file in a single call.
 
 Regular Expressions
 This library includes routines to determine whether a regular expression matches part or all of a string.
 
 Range-List (RL) trees
 

 
 Splay Trees
 Splay trees are explained in the paper "Self-adjusting Binary Search Trees", by D.D.
 
 Operating System Functionality
 Portable Interaction with the OS, be it Unix, Linux, OSX, or Windows.
 
 Utilities On Terms
 The next routines provide a set of commonly used utilities to manipulate terms.
 
 Calls With Timeout
 The time_out/3 command relies on the alarm/3 built-in to implement a call with a maximum time of execution.
 
 Updatable Binary Trees
 The following queue manipulation routines are available once included with the use_module(library(trees)) command.
 
 Trie DataStructure
 Engine Independent trie library.
 
 Unweighted Graphs
 The following graph manipulation routines are based in code originally written by Richard O'Keefe.
 
 Undirected Graphs
 The following graph manipulation routines use the red-black tree graph library to implement undirected graphs.
 
 Variabilize term.
 
 Weighted Directed Graphs
 

 
 Weighted Graphs
 Weighted Graph Processing Utilities.
 
 Weighted Undirected Graphs
 

 
 Yap PreProcessing
 
 Low-level access
 

 
 List Predicates in the Prolog Library
 

 
 SICStus compatible socket library
 uses SWI code
 

Class Documentation

◆ rannum/1

class rannum/1

@groupdef prandom Van Gelder Random Number Generator

% % The following code produces the same random numbers as my previous ranpkg.pl, but is more accurately documented and slightly more efficient


ranpkg.pl random number package Allen Van Gelder, Stanford % rannum produces a random non-negative integer whose low bits are not all that random, so it should be scaled to a smaller range in general The integer is in the range 0 2^(w-1) - 1, where w is the word size available for integers, e.g., 18 for DEC-10, and 16 or 32 for VAX and most IBM % ranunif produces a uniformly distributed non-negative random integer over a caller-specified range If range is R, the result is in 0 R-1 % ranstart must be called before the first use of rannum or ranunif, and may be called later to redefine the seed ranstart/0 causes a built-in seed to be used ranstart(N), N an integer, varies this, but the same N always produces the same sequence of numbers % According to my reading of Knuth, Vol 2, this generator has period 2^(w-1) and potency w/2 , i.e., 8, 9, or 16 in practice Knuth says potency should be at least 5, so this looks more than adequate Its drawback is the lack of randomness of low-order bits

rannum(- I)

Produces a random non-negative integer I whose low bits are not all that random, so it should be scaled to a smaller range in general The integer I is in the range 0 2^(w-1) - 1 You can use:

rannum(X) :- yap_flag(max_integer,MI), rannum(R), X is R/MI.
yap_flag( ?Param, ?Value)
@groupdef prandom Van Gelder Random Number Generator% % The following code produces the same random n...

to obtain a floating point number uniformly distributed between 0 and 1