qtil
advanced-security/qtil-swift 0.0.3
Search

Module Tp5::Map

Map a function over the tuples in this tuple set, and get a new tuple predicate back representing the set of tuples after being transformed by that function.

Sibling module of Relate (which takes a “relation” instead of a “function”).

Note that this implicitly performs a “flatMap,” as the mapping function may return zero or more than one result per tuple.

Example:

predicate livesIn(Person p, City c) { c = p.getCity() }
string describe(Person p, City c) { result = p.getName() + " lives in " + c.getName() }

// selects "Peter lives in New York", "Wanda lives in London", ...
select Tp2<Person, City, livesIn/2>::Map<string, describe/2>::find()

Import path

import qtil.fn.generated.Tp

Predicates

find

Get the result of mapping the function map over the set of tuples represented by this tuple predicate.

Parameters