![]() |
|
Navigation |
Synopsis Apply a function to all set elements and return set of results.
Function
set[&U] mapper(set[&T] st, &U (&T) fn)
Usage
import Set;
Description Return a set obtained by applying function
fn to all elements of set s .
Examples
rascal>import Set; ok rascal>int incr(int x) { return x + 1; } int (int): int incr(int); rascal>mapper({1, 2, 3, 4}, incr); set[int]: {2,3,4,5} Questions
Question [1].
![]() ![]()
Question [2].
![]() ![]() ![]() |