totally_lazy 0.1.55 → 0.1.56
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/readme.md +19 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmQyN2I0MzM0NzY5NjEyZGM4NDJmMzAwNzMwY2JiZjM2ZGY5ZThmOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDFhNDU0YzYxNjcwMjdlNmZmZjhlZTllYTIzNTAyMzZmMDMyYmZkZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGY0ZDg4NTE0M2Q5YmM0YmJlM2I1N2YxNmIxNzJiMTRmOTE2YjViMmRjMzc2
|
10
|
+
NjMxYmFmMWUwYmViNTllMTIzMWM2ZGFjYjU5NzI2YjYxZGIyNTI3OWJjMjMz
|
11
|
+
YjRmMGE5NDhlODg2ZTVlMDdjYTk1OTgyOGMyOTEwMzQyNzE1NGY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjkxMTNhMDlmMWNmZjI5MmNkODE3YjY0YWM1ZmRmYmFlNzE0YWM1MzYyM2Yx
|
14
|
+
Y2M1ZDYwYmQzZDE5NGQ0MTE2YzliYWI3YzBlYWU5YmQxNTg5OTRhYjVkYzQz
|
15
|
+
NDZlZGVhMGFkOGI3MjcwNzViMmRhOGRkYWI3NGMyMjNiMjRkY2Y=
|
data/readme.md
CHANGED
@@ -36,15 +36,23 @@ The following are some simple examples of the currently implemented functionalit
|
|
36
36
|
```ruby
|
37
37
|
require 'totally_lazy'
|
38
38
|
|
39
|
-
sequence(1,2,3,4).filter(even)
|
40
|
-
sequence(1,
|
41
|
-
sequence(1, 2).
|
42
|
-
sequence(1,2,3).
|
43
|
-
sequence(1,2
|
44
|
-
sequence(1,2
|
45
|
-
sequence(1,2,3).
|
46
|
-
sequence(1,2,3).
|
47
|
-
|
48
|
-
sequence(1, 2, 3
|
49
|
-
sequence(
|
39
|
+
sequence(1, 2, 3, 4).filter(even) # lazily returns 2,4
|
40
|
+
sequence(1, 3, 5).find(even) # eagerly returns none()
|
41
|
+
sequence(1, 2, 3).contains?(2) # eagerly returns true
|
42
|
+
sequence(1, 2, 3).exists?(even) # eagerly return true
|
43
|
+
sequence(1, 2).map(to_string) # lazily returns "1","2"
|
44
|
+
sequence(1, 2).map_concurrently(to_string) # lazily distributes the work to background threads
|
45
|
+
sequence(1, 2, 3).take(2) # lazily returns 1,2
|
46
|
+
sequence(1, 2, 3).drop(2) # lazily returns 3
|
47
|
+
sequence(1, 2, 3).tail # lazily returns 2,3
|
48
|
+
sequence(1, 2, 3).head # eagerly returns 1
|
49
|
+
sequence(1, 2, 3).reduce(sum) # eagerly return 6
|
50
|
+
sequence(1, 2, 3).for_all(odd) # eagerly returns false;
|
51
|
+
sequence(1, 2, 3).fold_left(0, add) # eagerly returns 6
|
52
|
+
some(sequence(1, 2, 3)).get_or_else(empty) # eagerly returns value or else empty sequence
|
53
|
+
sequence(1, 2, 3, 4, 5).filter(greater_than(2).and(odd))
|
54
|
+
# lazily returns 3,5
|
55
|
+
sequence(pair(1, 2), pair(3, 4)).filter(where(first, equal_to?(3)))
|
56
|
+
# lazily returns pair(3,4)
|
57
|
+
sequence(1, 2, 3).to_s # eagerly returns "[1,2,3]"
|
50
58
|
```
|