Home

setsuch

Setsuch is a term used in certain programming languages and mathematical discussions to denote an operation that builds a subset from a collection by selecting elements that satisfy a given condition. The name derives from the phrase “set such that,” commonly used in mathematical notation and set-builder concepts.

Formally, if S is a domain and P is a predicate that maps elements of S to

Usage and examples vary by language, but the core idea is consistent. For example, setsuch([1, 2, 3,

Origin and status: setsuch is not a standardized operator and appears mainly in informal discussions, tutorials,

See also: filter, set-builder notation, list comprehension, predicate.

a
boolean
value,
setsuch(S,
P)
yields
the
subset
{
x
in
S
|
P(x)
}.
In
many
languages
this
concept
is
implemented
as
a
higher-order
function
or
operator
that
filters
a
collection
according
to
a
predicate.
In
this
sense
setsuch
is
closely
related
to
the
filter
function
and,
in
more
declarative
languages,
to
set-builder
or
comprehension
constructs.
4],
x
=>
x
%
2
==
0)
would
produce
[2,
4].
In
a
typed
functional
language,
setsuch
might
require
a
function
of
the
element
type
that
returns
a
boolean,
and
the
result
would
be
a
subset
of
the
original
collection’s
type.
In
database-inspired
domains,
a
similar
operation
appears
as
a
constraint-based
selection
that
yields
rows
satisfying
a
predicate.
or
domain-specific
languages.
It
serves
to
illustrate
the
parallel
between
mathematical
set-builder
notation
and
practical
subset
selection
in
programming.