Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

mapcan

mapcan( 
u_func 
l_arg1 
[ l_arg2 ... ] 
) 
=> l_result

Description

Applies a function to successive elements of the argument lists and returns the result of appending these intermediate results. All of the lists should have the same length.

Specifically, a function is applied to the car of all the argument lists, passed in the same order as the argument lists. The second elements are processed next, continuing until the last element is processed. The result of each call to u_func must be a list. These lists are destructively modified and concatenated so that the resulting list of all the concatenations is the result of mapcan. The argument u_func must accept as many arguments as there are lists.

Arguments

u_func

Function to apply to argument lists.

l_arg1

Argument list.

l_arg2

Additional argument lists, which must be the same length as l_arg1.

Value Returned

l_result

List consisting of the concatenated results.

Examples

mapcan( 'list '(1 2 3) '(a b c) )
=> (1 a 2 b 3 c)
mapcan( (lambda (n) (and (plusp n) (list n))) '(1 -2 3 -4 5))
=> (1 3 5)

Related Topics

Flow Control Functions

map

mapc

mapcar

mapcan

maplist

nconc


Return to top
 ⠀
X