![]() |
|
Navigation |
Synopsis Apply a function to all list elements and return list of results.
Function
list[&U] mapper(list[&T] lst, &U (&T) fn)
Usage
import List;
Description Apply a function
fn to each element of lst and return the list of results.
Examples
rascal>import List; ok rascal>int incr(int x) { return x + 1; } int (int): int incr(int); rascal>mapper([1, 2, 3, 4], incr); list[int]: [2,3,4,5] Questions
Question [1].
![]() ![]()
Question [2].
![]() ![]() ![]() |