Lazy evaluation library

Author(s): Amadeo Casas, Jose F. Morales.

This module provides several predicates that make easier to develop predicates that will be executed lazily.

Usage and interface

Documentation on exports

PREDICATEnums_from/2

Usage:nums_from(X,List)

List is unified with an infinite list of successive numbers starting in X

Usage:nums_from_inc(X,Y,List)

List is unified with an infinite list of successive numbers starting in X with an increment of Y

PREDICATErepeat/2

Usage:repeat(X,List)

List is unified with an infinite list of the term Y

PREDICATEcycle/2

Usage:cycle(X,List)

List is unified with an infinite list of the term Y repeated infinite times

PREDICATEtake/3

Usage:take(X,ListA,ListR)

ListR is unified with the first X elements of the infinite list ListA

PREDICATEtakeWhile/3

Usage:takeWhile(P,ListA,ListR)

ListR is unified with the first elements of the infinite list ListA while the condition P is true

PREDICATEdrop/3

Usage:drop(X,ListA,ListR)

ListR is unified with the infinite list ListA dropping the first X elements

PREDICATEdropWhile/3

Usage:dropWhile(P,ListA,ListR)

ListR is unified with the infinite list ListA dropping the first elements while the condition P is true

PREDICATEsplitAt/3

Usage:splitAt(X,ListA,Res)

Res is unified with a tuple of lists where the first list is composed by the first X elements of the list ListA and the second list is composed by the rest of the elements of ListA

PREDICATEspan/3

Usage:span(P,ListA,Res)

Res is unified with a tuple of lists where the first list is composed by the elements of ListA which verify the condition P and the second list is composed by the rest of the elements of the initial list

PREDICATEtail/2

Usage:tail(ListA,ListR)

ListR is unified with the tail of the infinite list ListA

PREDICATElazy_map/3

Usage:lazy_map(ListA,P,ListR)

Version of the map/3 predicate to be executed lazily

Meta-predicate with arguments: lazy_map(?,pred(2),?).

PREDICATElazy_foldr/4

Usage:lazy_foldr(P,Xs,V0,V)

Lazy version of foldr/4

Meta-predicate with arguments: lazy_foldr(pred(3),?,?,?).

PREDICATElazy_foldl/4

Usage:lazy_foldl(P,Xs,V0,V)

Lazy version of foldl/4

Meta-predicate with arguments: lazy_foldl(pred(3),?,?,?).

PREDICATEzipWith/4

Usage:zipWith(P,ListA,ListB,ListR)

ListR is a list whose elements are calculated from the function P and the elements of input lists ListA and ListB occuring at the same position in both lists

Meta-predicate with arguments: zipWith(pred(3),?,?,?).

Documentation on imports

This module has the following direct dependencies: