Skip to content

Commit baa6410

Browse files
author
czheo
committed
update README.md
1 parent 30c232b commit baa6410

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

README.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,32 +76,26 @@ pipe(['google', 'twitter', 'yahoo', 'facebook', 'github'])
7676
# equivalent to `isinstance(1, int)`
7777

7878
1 /to/ 10
79-
# similar to `range(1, 11)`, but this is an iterator.
79+
# An iterator similar to `range(1, 11)`.
8080
# Python's nasty range() is right-exclusive. This is right-inclusive.
8181

82-
1 /to/ 10 /by/ 2
83-
# similar to `range(1, 11, 2)`, you can also specify step size
84-
8582
10 /to/ 1
86-
# similar to `range(10, 0, -1)`, you can also use decreasing ranges
87-
88-
10 /to/ 1 /by/ 2
89-
# similar to `range(10, 0, -2)`, you can also specify negative step size
83+
# We can go backward.
9084

9185
'0' /to/ '9'
92-
# similar to '0123456789', but this is an iterator.
93-
# we can also have a range of characters :)
86+
# We can also have a range of characters :)
9487

95-
'A' /to/ 'Z' /by/ 3
96-
# similar to 'ADGJMPSVY', but this is an iterator. Steps also work for characters!
88+
1 /to/ 10 /by/ 2
89+
# We can also specify step sizes.
90+
# Similar to `range(1, 11, 2)`
9791

98-
'v' /to/ 'd'
99-
# similar to 'vutsrqponmlkjihgfed', but this is an iterator
100-
# e can also have *decreasing* range of characters :)
92+
10 /to/ 1 /by/ 2
93+
# Go backward.
94+
# Similar to `range(10, 0, -2)`
10195

102-
'v' /to/ 'd' /by/ 3
103-
# similar to 'vspmjgd', but this is an iterator
104-
# e can also have *decreasing* range of characters with negative steps
96+
'A' /to/ 'Z' /by/ 3
97+
# Also works with characters with /by/.
98+
# An iterator similar to 'ADGJMPSVY'
10599
```
106100

107101
`/to/` has some advanced features
@@ -125,6 +119,7 @@ print([(x, y) for x, y in (1 /to/ 3) * (4 /to/ 6)])
125119
```
126120

127121
Make your own infix function, so you can append multiple items to a list in one line.
122+
128123
``` python
129124
@infix
130125
def push(lst, x):
@@ -174,7 +169,9 @@ fn = compose(f, g, h)
174169

175170
fn(5) # 245026
176171
```
172+
177173
or you can do
174+
178175
```python
179176
f = composable(lambda x: x**2 + 1)
180177
g = composable(lambda x: 2*x - 1)

0 commit comments

Comments
 (0)