Kernel Prolog with Fluent based Builtins

tarau.jinni
Class LazyList

java.lang.Object
  |
  +--tarau.jinni.Term
        |
        +--tarau.jinni.Nonvar
              |
              +--tarau.jinni.Const
                    |
                    +--tarau.jinni.Fun
                          |
                          +--tarau.jinni.Cons
                                |
                                +--tarau.jinni.LazyList

public class LazyList
extends Cons

Lazy List: produces Cons-like sequences, based on a Source. Saving a lazy list to the database does not make too much sense as it will be discarded when backtracking over its creation point. Note that a Lazy List has its own trail, and is only discarded when backtracking over its creation point.


Field Summary
private  boolean bound
           
private  Source source
           
private  Trail trail
           
 
Fields inherited from class tarau.jinni.Fun
args
 
Fields inherited from class tarau.jinni.Const
aFail, anEof, aNil, aNo, aTrue, aYes, sym
 
Fields inherited from class tarau.jinni.Term
CONST, INT, JAVA, REAL, VAR
 
Constructor Summary
LazyList(Term head, Source source, Trail trail)
           
 
Method Summary
private  void advance()
          advances the Lazy List, pulling out elements of the Source as needed
(package private)  boolean bind_to(Term that, Trail trail)
          this permissive definition for bind_to allows a Lazy List to Unify with any 2 arg constructor chain
 Const getNull()
           
 Term getTail()
          Advances the tail of a lazy list.
protected  void undo()
           
 
Methods inherited from class tarau.jinni.Cons
getHead, toString
 
Methods inherited from class tarau.jinni.Fun
funClone, funToString, getArg, getArity, getIntArg, init, initializedClone, isClause, listify, putArg, reaction, setArg, show_args, toBuiltin, token, unify_to, unInitializedClone, watchNull
 
Methods inherited from class tarau.jinni.Const
eq, getKey, name, qname, the, toUnquoted
 
Methods inherited from class tarau.jinni.Term
action, charsToString, copy, exec, exec, fromString, isBuiltin, matches, matching_copy, numbervars, pprint, pprint, ref, stringToChars, toChars, toClause, toObject, toTerm, unify, varsOf
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

source

private Source source

bound

private boolean bound

trail

private Trail trail
Constructor Detail

LazyList

public LazyList(Term head,
                Source source,
                Trail trail)
Method Detail

advance

private final void advance()
advances the Lazy List, pulling out elements of the Source as needed

getTail

public Term getTail()
Advances the tail of a lazy list. Note that they inherit getHead() from Cons.
Overrides:
getTail in class Cons

bind_to

boolean bind_to(Term that,
                Trail trail)
this permissive definition for bind_to allows a Lazy List to Unify with any 2 arg constructor chain
Overrides:
bind_to in class Fun

getNull

public Const getNull()

undo

protected void undo()
Overrides:
undo in class Term

Kernel Prolog with Fluent based Builtins