[ Reference Manual | Alphabetic Index ]

library(apply_macros)

Utilities to apply a predicate to all elements of a list resp. all subterms of a term   [more]

Predicates

applist(+Pred, +List)
Apply a predicate to all list elements
appnodes(+Pred, +Term)
Call Pred on all Subterms of Term (depth-first and left-to-right order)
checklist(+Pred, +List)
Apply a predicate to all list elements
fromto(+From, +To, +Step, +Pred)
Call Pred with the numbers From..To in increments of Step
mapargs(+Pred, +TermIn, ?TermOut)
Create new term by applying a predicate to all arguments
maplist(+Pred, +ListIn, ?ListOut)
Create new list by applying a predicate to all list elements
mapstream(+Pred, ?ListIn, ?ListOut)
Like maplist/3, but delays if ListIn is not complete
selectlist(+Pred, +ListIn, ?ListOut)
Creates output list of all list elements that pass a given test
sumargs(+Pred, +Term, ?AccIn, ?AccOut)
Call Pred on all arguments of Term and collect a result in Accumulator
sumlist(+Pred, +List, ?AccIn, ?AccOut)
Call Pred on all element of List and collect a result in Accumulator
sumnodes(+Pred, +Term, ?AccIn, ?AccOut)
Call Pred on all Subterms of Term and collect a result in Accumulator

Description

Note that this library is largely superseded by the do-loop construct!

A collection of utilities to apply a predicate to all elements of a list resp. all subterm of a term. To avoid performance degradation due to apply/2, they are implemented as macros, i.e. they are specialized into auxiliary predicates without metacalls, and the calls are translated into calls of the auxiliary predicates.

About


Generated from apply_macros.eci on 2022-09-03 14:26