clazy

API Reference

clazy

The CLAZY System.

IT.UNIMIB.DISCO.LAZY

The Common Lisp Extensions Lazy Evaluation Package.
  • Condition UNDEFINED-LAZY-FUNCTION  (UNDEFINED-FUNCTION)
    The Undefined Lazy Function Condition. A simple subclass of the UNDEFINED-FUNCTION condition. This is signalled by the LAZY operator and the LAZY:CALL macro when trying to access an undefined lazy function. This may happen also when a function has a strict definition but no lazy counterpart.
  • Condition INVALID-LAZY-ARGUMENT  (TYPE-ERROR)
    The Invalid Lazy Argument Condition. This condition is signalled by LAZY operator when it cannot get hold of a lazy version of the argument.
  • Struct LAZY-LAMBDA
    The Lazy Lambda Structure. This structure is a wrapper around a LAMBDA representing the actual lazy code. Its main use is as a `type' used in discrimination. The slot CODE contains the actual lazy code, while the slot ARGLIST containes the LAMBDA argilist. The slots are read only. No `copier' is defined. The instances are `immutable'. The constuctor is defined as MAKE-LAZY-LAMBDA (&optional CODE ARGLIST) with appropriate defaults. The other usual functions automatically generated by DEFSTRUCT work as expected.
    CODE
    ARGLIST
  • Function LAZY-LAMBDA-P (object)
  • Function LAZY-LAMBDA-CODE (instance)
  • Function LAZY-LAMBDA-ARGLIST (instance)
  • Struct THUNK
    The Thunk Structure. A wrapper for code fragments that will be evaluated after a delay. Thunks can be created either directly by the macro MAKE-THUNK or by the macro DELAY.
    CODE
    FORM
    TYPE
  • Function THUNK-P (object)
  • Function THUNK-CODE (instance)
  • Macro MAKE-THUNK (expr)
    Expands into code that creates a thunk wrapping around EXPR.
  • Macro DELAY (expression)
    Delays an EXPRESSION by wrapping it in a `thunk' (i.e. a closure).
  • Function FORCE (thunk)
    Forces the evaluation of a THUNK. If THUNK is a regular value it is returned as is.
  • Macro CALL (f &rest args)
    The LAZY:CALL macro generalizes FUNCALL in order to handle lazy functions. The LAZY:CALL macro introduces lazy evaluation in Common Lisp. The LAZY:CALL form ensures that, if possible, a lazy version of the function F is called, in which case all the arguments are automatically `thunked'. If no lazy version of F can be retrieved then F is FUNCALLed in the normal, strict, way with no `thunking' of the arguments.
  • Macro LAZY (function-spec &optional (errorp t))
    Transforms a function into a lazy equivalent. The LAZY macro is akin to the FUNCTION special operator. The function specified in FUNCTION-SPEC can be a symbol, a lambda expression or a FUNCTION special form. The macro operates at the syntactic level. The result is a function which may evaluate its arguments in a lazy way. This is achieved by ensuring that each argument is automatically interpreted as a 'thunk'. If FUNCTION-SPEC is a symbol which names a lazy function (cfr. LAZY-FUNCTION-NAME-P) then this is the result; if FUNCTION-SPEC is a lambda expression then it is `lazyfied'. The same happens if FUNCTION-SPEC is of the form (FUNCTION (LAMBDA ...)). If FUNCTION-SPEC is of the form (FUNCTION <symbol>), then LAZY falls back to the first case. In every other case, LAZY may yield a `regular' function. If ERRORP is non-NIL, an error of type INVALID-LAZY-ARGUMENT is generated if there is no way to associate FUNCTION-SPEC to a function; otherwise NIL is returned.
  • Macro DEFLAZY (name args &body body)
    Defines a function while ensuring that a lazy version exists as well.
  • Macro DEF-LAZY-FUNCTION (name args &body body)
    Defines a lazy function. The function assumes that each argument is passed as a `thunk', which gets FORCEd as needed.
  • Macro LET/LAZY (bindings &body body)
    The macro operates like LET, but is delays the evaluation of the bindings.
  • Struct LAZY-STREAM
    The Lazy Stream Structure. The traditional implementation of SICP-like streams. The LAZY-STREAM structure has a strict head and a lazy tail.
    HEAD
    TAIL
  • Function COPY-LAZY-STREAM (instance)
  • Function LAZY-STREAM-P (object)
  • Struct LAZY-CONS
    The Lazy Cons Structure. The LAZY-CONS structure has both head and tail lazy. It includes LAZY-STREAM.
    No slots.
  • Function LAZY-CONS-P (object)
  • Macro CONS-STREAM (head tail)
    Constructs a LAZY-STREAM, DELAYing the TAIL argument.
  • Function HEAD (s)
    Returns the first element of a SEQUENCE or a LAZY-STREAM.
  • Function TAIL (s)
    Returns the rest of a LIST or LAZY-STREAM.
  • Function REPEATEDLY (fn &rest args)
    Returns a lazy list containing repeated applications of FN to ARGS.
  • Macro SLACKING (&body body)
  • Macro LAZILY (&body body)
    Ensures that lazy functions are called lazily with LAZY:CALL. The macro code-walks BODY and whenever it finds an application that has a lazily defined operator, then it rewrites such application with LAZY:CALL.
  • Function DIVERGE
    A function that never returns. It is equivalent to (LOOP). It should not be called striclty: called striclty: it will never terminate.

IT.UNIMIB.DISCO.MA.CL.EXT.SEQUENCES.LAZY

  • Type SEQ-INDEX
    The type of the indices inside a sequence. Although not necessarily right for lists, the upper bound is set to ARRAY-DIMENSION-LIMIT.
  • Type LIST-INDEX
    The type of the indices inside a list. Although not necessarily right for lists, the upper bound is set to MOST-POSITIVE-FIXNUM.
  • Function TAKE (n seq)
    Takes the first N elements of the sequence SEQ. The result is a fresh sequence of the first N elements. SEQ can be a SEQUENCE or a LAZY-STREAM. The type of the result is the same as the type of SEQ if this is a SEQUENCE, otherwise it is a LIST.
  • Function DROP (n seq)
    Drops the first N elements of the sequence SEQ. The result is a fresh sequence of the last (- (length SEQ) N) elements. SEQ can be a SEQUENCE or a LAZY-STREAM. The type of the result is the same as the type of SEQ if this is a SEQUENCE, otherwise it is a LAZY-STREAM or NIL (if dropping more items than the - finite - length of the LAZY-STREAM).
  • Function SPLIT-AT (n seq)
    Returns two subsequences of SEQ split at the N-th element.
  • Function TAKE-WHILE (p seq)
    Takes the first elements of the sequence SEQ that satisfy the predicate P. SEQ can be a SEQUENCE or a LAZY-STREAM. The type of the result is the same as the type of SEQ if this is a SEQUENCE, otherwise it is a LIST.
  • Function DROP-WHILE (p seq)
    Drops the first elements of the sequence SEQ that satisfy the predicate P.
  • Function SPAN (p seq)
  • Function SEPARATE (p seq)
  • Function TAILS (seq)
  • Function DISTINCT (seq &rest keys &key (test #'eql) (key #'identity) ((distincts-table dst) (make-hash-table :test test)) &allow-other-keys)
    Returns a generalized sequence of distinct elements. If SEQ is a SEQUENCE then REMOVE-DUPLICATES is called. If it is a LAZY-STREAM then a new LAZY-STREAM is returned, with repeated elements removed. Key arguments are only TEST and KEY. Arguments and Values: SEQ : a (OR NULL SEQUENCE LAZY-STREAM) TEST : a (FUNCTION (T T) <generalized boolean>) KEY : a (FUNCTION (T) T) DISTINCTS-TABLE : a HASH-TABLE KEYS : a LIST (actually a p-list of the keywords arguments) result : a (OR NULL SEQUENCE LAZY-STREAM)