Rewrite indexedMapFunc as a function declaration.