2 //doc
Map asList Converts a
Map to a
list of lists
. Each element in the returned
list will be a
list of two elements
: the key
, and the value
.
5 foreach(k
, v
, l
append(list(k
, v
)))
12 value
:= call
argAt(1)
15 call
sender setSlot(key name
, k
)
16 call
sender setSlot(value name
, v
)
17 ss
:= stopStatus(r
:= call
sender doMessage(body
))
18 if(ss isReturn
, call
setStopStatus(ss
); return getSlot("v"))
20 if(ss isContinue
, continue)
21 result
append(getSlot("r"))
29 self keys
foreach(key
,
31 call
sender setSlot(call
argAt(0) name
, key
)
32 if(call argCount
== 3,
33 call
sender setSlot(call
argAt(1) name
, self at(key
))
36 ss
:= stopStatus(v
:= call
evalArgAt(call argCount
- 1))
37 if(ss isReturn
, call
setStopStatus(ss
); return getSlot("v"))
39 if(ss isContinue
, continue)
41 result
atPut(key
, self at(key
))
48 self keys
foreach(key
,
50 call
sender setSlot(call
argAt(0) name
, key
)
51 if(call argCount
== 3,
52 call
sender setSlot(call
argAt(1) name
, self at(key
))
55 ss
:= stopStatus(v
:= call
evalArgAt(call argCount
- 1))
56 if(ss isReturn
, call
setStopStatus(ss
); return getSlot("v"))
58 if(ss isContinue
, continue)
60 return list(key
, self at(key
))
66 Map clone addKeysAndValues(values
, keys
)
71 self foreach(k
, v
, o
setSlot(k
, getSlot("v")))