MMAP
maps
The MMAP
function applies a macro on each key/value pair of a MAP, producing a MAP with the two elements on top of the stack after each macro invocation.
The macro is called with a stack containing the MAP index on top and the key/value pair at that particular index below it.
Since Warp 10 2.4.0, you can override this behaviour with a boolean.
MMAP is available since version 2.7.0.
See also
Signatures
Examples
{
'klingon' 10
'vulcan' 127
'romulan' 78
'ferengi' 2
'borg' 0
}
<%
[ 'k' 'v' ] STORE
$k TOUPPER
$v 2 **
%>
false MMAP
Examples
map = {
'klingon': 10,
'vulcan': 127,
'romulan': 78,
'ferengi': 2,
'borg': 0
}
macro = (k, v) -> 2 {
k1 = TOUPPER(k)
v1 = v ** 2
return k1, v1
}
return MMAP(map, macro, false)