functions 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/functions/prelude_lambda/basic.rb +6 -2
- data/lib/functions/version.rb +1 -1
- data/spec/prelude_lambda_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2Q2YWQzNDg3ZDc2MTRjMGZlNjhhOGUwYTM2MmYzMmEwZjBjN2JiMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmYzMDBlZjM2NTZhNmE4MDBjOWRlYjMxNmY3MWViMjFlMjc0OTE0MA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGJkYWJmOTIxNzE2MGVmZDllMjU5ZDY3ZDZlYjc0YWM2NDI2YThkOTUzZGMw
|
10
|
+
ZDg1NjZiN2Q1MjI0NmY2OTNhMmI2Zjc1ODI2NWFhYmQzMjZjM2VjMTQxMzZk
|
11
|
+
M2VjNDFjNTYwZDlmYTBkNzVjZTU5MDhhN2ExZWUzZTcxN2YzNjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjEwOGRmMzc5ODRlODU3ZGE2ZGQ5NGRiMDE1ZWFhMGI2MTkwOGI5MDdjZTdl
|
14
|
+
NDhmOGJkNDJhOGU3NzRlZDA2ZDFjZGU4ZjFiN2M0OTdhZTA3NjBhZmUwMTUw
|
15
|
+
NzNlZDM1YzMzNDMwMGQxZDY5YzRkOTg1NTVjNTZkNjUxMWZiYmI=
|
@@ -81,9 +81,13 @@ module Functions
|
|
81
81
|
|
82
82
|
Zip = ->(a, b) { a.zip(b) }.curry
|
83
83
|
|
84
|
-
|
84
|
+
Merge_Hash = ->(as, bs) { as.merge(bs) { |k, a, b| [a, b] } }.curry
|
85
85
|
|
86
|
-
|
86
|
+
Zip_Hash_Left = ->(as, bs) { as.each_with_object({}) { |(k, a), h| h[k] = [a, bs[k]]; h } }.curry
|
87
|
+
|
88
|
+
Zip_Hash_Inner = ->(as, bs) { as.each_with_object({}) { |(k, a), h| b = bs[k]; h[k] = [a, b] if b; h } }.curry
|
89
|
+
|
90
|
+
Zip_Hash_Right = ->(as, bs) { bs.each_with_object({}) { |(k, b), h| h[k] = [as[k], b]; h } }.curry
|
87
91
|
|
88
92
|
Map = ->(f, a) { a.map { |x| f.(x) } }.curry
|
89
93
|
|
data/lib/functions/version.rb
CHANGED
data/spec/prelude_lambda_spec.rb
CHANGED
@@ -49,4 +49,13 @@ describe Functions::Prelude, "basic" do
|
|
49
49
|
Merge_Sort.([3,3,5,6,7,1,2]).should == [1,2,3,3,5,6,7]
|
50
50
|
end
|
51
51
|
|
52
|
+
it "merges hashes" do
|
53
|
+
a = { a: 'a', b: 'b' }
|
54
|
+
b = { a: '1', c: '3' }
|
55
|
+
Merge_Hash.(a,b).should == { a: ['a','1'], b: 'b', c: '3' }
|
56
|
+
Zip_Hash_Left.(a,b).should == { a: ['a','1'], b: ['b', nil] }
|
57
|
+
Zip_Hash_Right.(a,b).should == { a: ['a','1'], c: [nil, '3'] }
|
58
|
+
Zip_Hash_Inner.(a,b).should == { a: ['a','1'] }
|
59
|
+
end
|
60
|
+
|
52
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: functions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koen Handekyn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: functional programming in ruby
|
14
14
|
email:
|