Description

Primitives for Expressing Iterative Lazy Algorithms

Author

Kon Lovett

Usage

(require-extension srfi-45)

Requires

Download

srfi-45.egg

Documentation

Extends the interpretation of a "promise" to include "lazy" and "eager" promises. Unlike the reference implementation this version does not redefine 'delay'.

For more information see SRFI-45.

macro: (delay EXPRESSION)

Returns a promise, a delayed evaluation of EXPRESSION.

Note that 'delay' is not re-defined here. Mentioned only for completeness.

macro: (lazy EXPRESSION)

Returns a promise for EXPRESSION.

The promise will be iteratively forced, overwriting the promise at each step before the next iteration, so as to avoid storage leaks.

macro: (eager EXPRESSION)

Returns a promise but immediately evaluates EXPRESSION.

Not much of a promise, more of a boxed value. For exposition purposes in algorithms.

procedure: (force OBJECT)

Assuming the OBJECT is some kind of promise, returns the result of the delayed evaluation.

procedure: (standard-force OBJECT)

Assuming the OBJECT is a standard promise, returns the result of the delayed evaluation.

The R5RS 'force'.

procedure: (promise? OBJECT)

Some kind of promise?

procedure: (standard-promise? OBJECT)

The R5RS 'promise?'

procedure: (recursive-promise? OBJECT)

Recursive promise?

procedure: (lazy-promise? OBJECT)

Lazy recursive promise?

procedure: (eager-promise? OBJECT)

Eager recursive promise?

Version

License

Copyright (c) 2006, Kon Lovett.  All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the Software),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

Does not supersede any restrictions in the source.