church 0.0.10 → 0.0.11
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.
- data/lib/church/lambda.rb +3 -0
- data/lib/church/version.rb +1 -1
- data/lib/church.rb +1 -0
- data/spec/lambda_spec.rb +15 -0
- metadata +4 -1
data/lib/church/version.rb
CHANGED
data/lib/church.rb
CHANGED
data/spec/lambda_spec.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Church
|
4
|
+
|
5
|
+
describe 'COMPOSE' do
|
6
|
+
ADD_TWO = -> x { 2 + x }
|
7
|
+
MUL_SIX = -> x { 6 * x }
|
8
|
+
SIX_X_PLUS_TWO = COMPOSE[ADD_TWO, MUL_SIX]
|
9
|
+
|
10
|
+
(-50..50).each do |x|
|
11
|
+
it "should compose two lambdas f and g and return f[g[x]]" do
|
12
|
+
expect(SIX_X_PLUS_TWO[x]).to be x * 6 + 2
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: church
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -60,12 +60,14 @@ files:
|
|
60
60
|
- lib/church/array.rb
|
61
61
|
- lib/church/hash.rb
|
62
62
|
- lib/church/io.rb
|
63
|
+
- lib/church/lambda.rb
|
63
64
|
- lib/church/math.rb
|
64
65
|
- lib/church/utils.rb
|
65
66
|
- lib/church/version.rb
|
66
67
|
- spec/array_spec.rb
|
67
68
|
- spec/hash_spec.rb
|
68
69
|
- spec/io_spec.rb
|
70
|
+
- spec/lambda_spec.rb
|
69
71
|
- spec/math_spec.rb
|
70
72
|
- spec/spec_helper.rb
|
71
73
|
- spec/utils_spec.rb
|
@@ -99,6 +101,7 @@ test_files:
|
|
99
101
|
- spec/array_spec.rb
|
100
102
|
- spec/hash_spec.rb
|
101
103
|
- spec/io_spec.rb
|
104
|
+
- spec/lambda_spec.rb
|
102
105
|
- spec/math_spec.rb
|
103
106
|
- spec/spec_helper.rb
|
104
107
|
- spec/utils_spec.rb
|