daitai 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +49 -1
- data/lib/daitai.rb +6 -0
- data/lib/daitai/and.rb +9 -0
- data/lib/daitai/not.rb +9 -0
- data/lib/daitai/or.rb +9 -0
- data/lib/daitai/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d70d158150cb85fa180ef5eedbd858368d2eba0d474d9beeba5adf9d1028ea6
|
4
|
+
data.tar.gz: 600957ef322eedc755d0017db3f4fdbce7361fda53433bb60afabc38ecba1f25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80c98f68eedf9d2cd6da6ce4e77e2e4d987759a45f189b8f934b65fa5024c89195830b1bffefa4b6fe3565b78ee41f493c5618362741ce828186fb4cf1c74d47
|
7
|
+
data.tar.gz: 81cb88d9193357e98b5c43d491764157bd91f6882eb48a9ab339ce39b5db95bd8c42ca263c8ba4f012fa03fed39f60c634dc33bc92a39f6bb0ce997c229ea762
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Daitai [![Build Status](https://travis-ci.org/walerian777/daitai.svg?branch=master)](https://travis-ci.org/walerian777/daitai)
|
1
|
+
# Daitai [![Build Status](https://travis-ci.org/walerian777/daitai.svg?branch=master)](https://travis-ci.org/walerian777/daitai) [![Gem Version](https://badge.fury.io/rb/daitai.svg)](https://badge.fury.io/rb/daitai)
|
2
2
|
|
3
3
|
Daitai (代替, Japanese for "alternative") is a functional library for Ruby language.
|
4
4
|
|
@@ -32,10 +32,13 @@ $ gem install daitai
|
|
32
32
|
|
33
33
|
## Documentation
|
34
34
|
* [all](#all-definition)
|
35
|
+
* [and](#and-definition)
|
35
36
|
* [any](#any-definition)
|
36
37
|
* [compose](#compose-definition)
|
37
38
|
* [filter](#filter-definition)
|
38
39
|
* [map](#map-definition)
|
40
|
+
* [not](#not-definition)
|
41
|
+
* [or](#or-definition)
|
39
42
|
* [pipe](#pipe-definition)
|
40
43
|
* [reduce](#reduce-definition)
|
41
44
|
* [sort](#sort-definition)
|
@@ -56,6 +59,21 @@ Daitai.all.(even, [2, 4, 7, 8]) # => false
|
|
56
59
|
|
57
60
|
- - -
|
58
61
|
|
62
|
+
<h4 id='and-definition'>
|
63
|
+
<code>and :: Bool -> Bool -> Bool</code>
|
64
|
+
</h4>
|
65
|
+
|
66
|
+
Boolean `and` - returns `true` if both arguments are true. Otherwise returns `false`.
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
Daitai.and.(true, true) # => true
|
70
|
+
Daitai.and.(true, false) # => false
|
71
|
+
Daitai.and.(false, true) # => false
|
72
|
+
Daitai.and.(false, false) # => false
|
73
|
+
```
|
74
|
+
|
75
|
+
- - -
|
76
|
+
|
59
77
|
<h4 id='any-definition'>
|
60
78
|
<code>any :: (a -> Bool) -> [a] -> Bool</code>
|
61
79
|
</h4>
|
@@ -111,6 +129,36 @@ Daitai.map.(triple, [1, 2, 3, 4]) # => [3, 6, 9, 12]
|
|
111
129
|
|
112
130
|
- - -
|
113
131
|
|
132
|
+
<h4 id='not-definition'>
|
133
|
+
<code>not :: Bool -> Bool</code>
|
134
|
+
</h4>
|
135
|
+
|
136
|
+
Boolean `not` - returns a contradiction of the argument.
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
Daitai.not.(true) # => false
|
140
|
+
Daitai.not.(false) # => true
|
141
|
+
Daitai.not.('λ') # => false
|
142
|
+
Daitai.not.(nil) # => true
|
143
|
+
```
|
144
|
+
|
145
|
+
- - -
|
146
|
+
|
147
|
+
<h4 id='or-definition'>
|
148
|
+
<code>or :: Bool -> Bool -> Bool</code>
|
149
|
+
</h4>
|
150
|
+
|
151
|
+
Boolean `or` - returns `true` if at least one of the arguments is true. Otherwise returs `false`.
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
Daitai.or.(true, true) # => true
|
155
|
+
Daitai.or.(true, false) # => true
|
156
|
+
Daitai.or.(false, true) # => true
|
157
|
+
Daitai.or.(false, false) # => false
|
158
|
+
```
|
159
|
+
|
160
|
+
- - -
|
161
|
+
|
114
162
|
<h4 id='pipe-definition'>
|
115
163
|
<code>pipe :: (a -> b) -> (b -> c) -> (a -> c)</code>
|
116
164
|
</h4>
|
data/lib/daitai.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
require 'daitai/all'
|
2
|
+
require 'daitai/and'
|
2
3
|
require 'daitai/any'
|
3
4
|
require 'daitai/compose'
|
4
5
|
require 'daitai/filter'
|
5
6
|
require 'daitai/map'
|
7
|
+
require 'daitai/not'
|
8
|
+
require 'daitai/or'
|
6
9
|
require 'daitai/pipe'
|
7
10
|
require 'daitai/reduce'
|
8
11
|
require 'daitai/sort'
|
@@ -10,10 +13,13 @@ require 'daitai/version'
|
|
10
13
|
|
11
14
|
module Daitai
|
12
15
|
extend All
|
16
|
+
extend And
|
13
17
|
extend Any
|
14
18
|
extend Compose
|
15
19
|
extend Filter
|
16
20
|
extend Map
|
21
|
+
extend Not
|
22
|
+
extend Or
|
17
23
|
extend Pipe
|
18
24
|
extend Reduce
|
19
25
|
extend Sort
|
data/lib/daitai/and.rb
ADDED
data/lib/daitai/not.rb
ADDED
data/lib/daitai/or.rb
ADDED
data/lib/daitai/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daitai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Walerian Sobczak
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,10 +88,13 @@ files:
|
|
88
88
|
- daitai.gemspec
|
89
89
|
- lib/daitai.rb
|
90
90
|
- lib/daitai/all.rb
|
91
|
+
- lib/daitai/and.rb
|
91
92
|
- lib/daitai/any.rb
|
92
93
|
- lib/daitai/compose.rb
|
93
94
|
- lib/daitai/filter.rb
|
94
95
|
- lib/daitai/map.rb
|
96
|
+
- lib/daitai/not.rb
|
97
|
+
- lib/daitai/or.rb
|
95
98
|
- lib/daitai/pipe.rb
|
96
99
|
- lib/daitai/reduce.rb
|
97
100
|
- lib/daitai/sort.rb
|