RosettaCodeData/Task/Call-a-function/Lingo/call-a-function-7.lingo

21 lines
495 B
Text
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
----------------------------------------
-- One of the five native iterative methods defined in ECMAScript 5
-- @param {list} tList
-- @param {symbol} cbFunc
-- @param {object} [cbObj=_movie]
-- @return {list}
----------------------------------------
on map (tList, cbFunc, cbObj)
if voidP(cbObj) then cbObj = _movie
res = []
cnt = tList.count
repeat with i = 1 to cnt
res[i] = call(cbFunc, cbObj, tList[i], i, tList)
end repeat
return res
end
on doubleInt (n)
return n*2
end