f::map (public)

 f::map f xs

Defined in packages/acs-tcl/tcl/ad-functional-procs.tcl

Takes a function f and a list { x1 x2 x3 ...}, applies the function on each element of the list and returns the result, i.e. { f x1, f x2, f x3, ...}. Examples: (fib = fibonacci function, sqr = square function) Applying a function to each element of a list: f::map fib [list 0 1 2 3 4 5 6 7 8] = {0 1 1 2 3 5 8 13 21} Applying a function to each element of a matrix (a list of lists) can be done with a nested call: f::map [f::lambda {row} {f::map sqr $row}] [list [list 1 2 3] [list 4 5 6]] = {{1 4 9} {16 25 36}}

Parameters:
f (required)
xs (required)

Partial Call Graph (max 5 caller/called nodes):
%3 test_functional_api functional_api (test acs-tcl) f::map f::map test_functional_api->f::map f::all f::all (public) f::all->f::map f::any f::any (public) f::any->f::map f::pascal f::pascal (public) f::pascal->f::map

Testcases:
functional_api
[ show source ]
Show another procedure: