Language docs

Sequence library

Reference for quotation-backed sequence construction, traversal, and reduction words exported by the top-level `seq` module.

This page lists the public words currently defined in the top-level seq library module.

seq.ffp

Source: ff/lib/seq/seq.ffp
Import: .import <seq/seq>

WordStack effectDescription
unita -- [a]Wraps a single value as a one-item quotation.
stack.. -- [..]Captures the current stack as a quotation.
in.. [Q] -- ..'Evaluates a quotation against a captured stack value layout.
paira b -- [a b]Wraps two values as a quotation pair.
compose[A] [B] -- [A then B]Composes two quotations into one quotation.
map!a* [B] -- b*Applies a quotation to each stack item in place.
reduce!a+ [B] -- rReduces stack items with a quoted reducer.
head!a+ -- aReturns the first item from a non-empty stack sequence.
tail!a+ -- a*Returns all but the first item from a non-empty stack sequence.
last!.. a -- aReturns the last item from the current stack sequence.
reduce_r!a+ [B] -- rReduces stack items from the right.
foldr!a* [B] z -- rRight-folds stack items with an explicit seed.
reduce_l!a+ [B] -- rReduces stack items from the left.
foldl!a* [B] z -- rLeft-folds stack items with an explicit seed.
reverse!a* -- a*Reverses a stack-backed sequence in place.
filter!a* [B] -- a*Keeps only the items whose predicate quotation is truthy.
map[A] [B] -- [C]Builds a mapped quotation from an input quotation and mapper.
first[A] -- aReturns the first element of a quoted sequence.
tail[A] -- [B]Returns a quoted sequence without its first element.
last[A] -- aReturns the last element of a quoted sequence.
foldr[A] [B] z -- rRight-folds a quoted sequence with a seed value.
foldl[A] [B] z -- rLeft-folds a quoted sequence with a seed value.
reverse[A] -- [B]Reverses a quoted sequence.
filter[A] [B] -- [C]Filters a quoted sequence with a predicate quotation.
sum!.. -- nSums the current stack sequence.
product!.. -- nMultiplies the current stack sequence.
sum[A] -- nSums a quoted sequence.
product[A] -- nMultiplies a quoted sequence.
length[A] -- nReturns the number of elements in a quoted sequence.
emptyq?[A] -- flagTests whether a quoted sequence is empty.
seq=[A] [B] -- flagTests quoted sequences for element-wise equality.