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

mapcon

mapcon( 
u_func 
l_arg1 
[ l_arg2 ] 
) 
=> l_result

Description

Applies the function u_func to successive sublists of the lists and returns a concatenated list.

Arguments

u_func

Specifies the function to be applied to the given list. Must accept lists as arguments. The result of calling u_func can be of any data type.

l_arg1

Specifies the argument list to be processed

l_arg2

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

Value Returned

l_result

Returns a concatenated list that results from calling the u_func on the cons cells of the given list

Examples

mapcon((lambda (x)
(printf "x = %L\n" x)
(list (car x) (add1 (car x)))) '(1 2 3 4)); lambda: (u_func) with one argument
x = (1 2 3 4)
x = (2 3 4)
x = (3 4)
x = (4)
result: (1 2 2 3 3 4 4 5)
mapcon((lambda (x y) (printf "x = %L y = %L\n" x y)
  (list (car x) (add1 (car y))))
  '(1 2 3 4)
  '(4 3 2 1)
) ; lambda: (u_func) is with 2 arguments
x = (1 2 3 4) y = (4 3 2 1)
x = (2 3 4) y = (3 2 1)
x = (3 4) y = (2 1)
x = (4) y = (1)
result : (1 5 2 4 3 3 4 2)

Related Topics

Flow Control Functions

map

mapc

mapcan

maplist

nconc


Return to top
 ⠀
X