A lightweight programming environment for desktop and mobile devices
map = function(arr, f)
  local result = {}
  for _, x in ipairs(arr) do
    table.insert(result, f(x))
  end
  return result
end