https://github.com/teemu/superpowers
Sane map() for unsane Python users
https://github.com/teemu/superpowers
functional-programming map python
Last synced: about 1 month ago
JSON representation
Sane map() for unsane Python users
- Host: GitHub
- URL: https://github.com/teemu/superpowers
- Owner: Teemu
- Created: 2017-09-06T16:12:59.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-06T19:36:12.000Z (about 8 years ago)
- Last Synced: 2025-05-27T23:02:17.189Z (6 months ago)
- Topics: functional-programming, map, python
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Superpowers
Sane map() for lists for unsane people.
## Usage
The following is valid code after using this library:
````python
from superpowers import patch, _
patch()
[1, 2, 3].map(_ * 3 + 3)._(print)
# [6, 9, 12]
['Hello', 'World'].map(_.upper).mkString(', ')._(print)
# HELLO, WORLD
[1, 2, 3, 4, 5].filter(_ > 3).map(print)
# 4
# 5
(1000).together(3001).together(1000)._(range)._(list).map(str).mkString(', ').together('are big numbers')._(print)
# 1000, 2000, 3000 are big numbers
````