Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kunigami
Last active December 26, 2019 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunigami/0d301370f348fdb76cdb4fc2675e7b08 to your computer and use it in GitHub Desktop.
Save kunigami/0d301370f348fdb76cdb4fc2675e7b08 to your computer and use it in GitHub Desktop.
def typed_map(xs: List[int], f: Callable[[int], int]) -> List[int]:
return [f(x) for x in xs]
print(typed_map([1, 2, 3], lambda x: x*2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment