Capy-Bearer Documentation

map

lib call

Capy

function map(items : dval, mapper : function(value : string) string) dval

Description

map() calls mapper for each item in items.

It converts each item to a string before it calls mapper. The function returns a new dval list.

Parameters

items : the input list

mapper : the function that transforms each item

Return Values

a new list of transformed strings

Example

Capy

var names := dval(["ada", "grace"])
var names_upper := map(names, function(name : string) string { return upper(name) })
print(join(names_upper, ","), "\n")