Working through the lecture notes again, for now, I can buy the e-book shortly.
>
Think of map as a function maker.
After making the function, the job of map is done.
Is the function passed to map by square a callback? Or not, perhaps because it is not a parameter of map, or perhaps map does not call the function?
function map(f)
return function (l)
local nl = {}
for i, x in ipairs(l) do
nl[i] = f(x)
end
return nl
end
end
square = map(function (x) return x * x end)
print(table.unpack(square{ 1, 5, 9 }))