daitai 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46621d1de1dd992af0bf8d119545ab537e8576c61a95bc7227256c06b54dae3e
4
- data.tar.gz: '097adb04342ddf86538403fe49ba72d5223777f5b2e855fa48e9e7b3827985ab'
3
+ metadata.gz: 3d70d158150cb85fa180ef5eedbd858368d2eba0d474d9beeba5adf9d1028ea6
4
+ data.tar.gz: 600957ef322eedc755d0017db3f4fdbce7361fda53433bb60afabc38ecba1f25
5
5
  SHA512:
6
- metadata.gz: 148744cc281ddc527ade6d0726a035a4221c3894f50dd33f0a127274a4439cc73738d04a760357430160e8278dd09af29051a363bf7b7827031ea0d6c92c44e7
7
- data.tar.gz: 84896991442c89ea623d960d56a7b962b2d0f3cbc1689eee29123b6a81b4fb42641972bfd8fa243baaa4ba473913f821cdd40d6ec1ccf0e30d3239ed1420b64c
6
+ metadata.gz: 80c98f68eedf9d2cd6da6ce4e77e2e4d987759a45f189b8f934b65fa5024c89195830b1bffefa4b6fe3565b78ee41f493c5618362741ce828186fb4cf1c74d47
7
+ data.tar.gz: 81cb88d9193357e98b5c43d491764157bd91f6882eb48a9ab339ce39b5db95bd8c42ca263c8ba4f012fa03fed39f60c634dc33bc92a39f6bb0ce997c229ea762
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- daitai (0.1.0)
4
+ daitai (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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>
@@ -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
@@ -0,0 +1,9 @@
1
+ module Daitai
2
+ module And
3
+ def and
4
+ lambda do |a, b|
5
+ a && b
6
+ end.curry
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Daitai
2
+ module Not
3
+ def not
4
+ lambda do |a|
5
+ !a
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Daitai
2
+ module Or
3
+ def or
4
+ lambda do |a, b|
5
+ a || b
6
+ end.curry
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Daitai
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
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.0
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-23 00:00:00.000000000 Z
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