Skip to content

Restricted ​

An anonymous restriction of coll to the elements satisfying predicate, delegating to Filter so the base collection stays lazy — the mechanism every named restriction (Derangements, OddPartitions, …) is built on, minus the name.

Restricted(coll, predicate)coll filtered to the elements satisfying predicate, kept lazy through Filter.
Typed signatures
TypePackageApplies
(collection, function) -> collectioncombinatoricsalways

Domain: Combinatorial maps

Examples

Basic #

The multiples of 3 up to 10

live ↗
InRestricted(1..10,n↦n mod 3=0)\mathrm{Restricted}(1..10, n↦n\bmod3=0)Out[3,6,9]\bigl\lbrack3, 6, 9\bigr\rbrack
About
Examples1

See also: Filter