egison 0.3.0 → 0.4.0
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 +4 -4
- data/README.md +9 -2
- data/lib/egison/core.rb +2 -2
- data/lib/egison/version.rb +1 -1
- data/sample/combination.rb +2 -0
- data/sample/join.rb +2 -0
- data/sample/poker_hands.rb +2 -0
- data/sample/set.rb +2 -0
- data/sample/stream.rb +2 -0
- data/spec/sample/combination_spec.rb +2 -0
- data/spec/sample/join_spec.rb +2 -0
- data/spec/sample/poker_hands_spec.rb +2 -0
- data/spec/sample/set_spec.rb +2 -0
- data/spec/sample/stream_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 146ed0f768555e2dc73b59c7468dc1d2dd0cfa6a
|
4
|
+
data.tar.gz: 8d4a4486865bff5cca675ac45117443b2da7e665
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd3b48d5efa466113bae4eca3eb6e2f0bc5efb9405783a95f3d91bdad65d7b15a7aa4aad8d4859a36eebc3d30df245fa093a5caa69d3312d35069a5747965ccd
|
7
|
+
data.tar.gz: bd41119e0da423aa3b9fb66ca69c6bf03d25bb8e7a81fe9030de230ded0ffd7e10e82ab09f236e9d828c9ccf6de1abed9452322b3bfef697979daf2196aff144
|
data/README.md
CHANGED
@@ -27,11 +27,13 @@ $ bundle install
|
|
27
27
|
|
28
28
|
## Basic Usage
|
29
29
|
|
30
|
-
The library provides `
|
30
|
+
The library provides `Egison#match_all` and `Egison#match`.
|
31
31
|
|
32
32
|
```
|
33
33
|
require 'egison'
|
34
34
|
|
35
|
+
include Egison
|
36
|
+
|
35
37
|
match_all(object) do
|
36
38
|
with(pattern) do
|
37
39
|
...
|
@@ -171,6 +173,8 @@ We can enumerates all combinations of the elements of a collection with pattern-
|
|
171
173
|
```
|
172
174
|
require 'egison'
|
173
175
|
|
176
|
+
include Egison
|
177
|
+
|
174
178
|
p(match_all([1,2,3,4,5]) do with(List.(*_, _x, *_, _y, *_)) { [x, y] } end)
|
175
179
|
#=> [[1, 2], [1, 3], [1, 4], [1, 5], [2, 3], [2, 4], [2, 5], [3, 4], [3, 5], [4, 5]]
|
176
180
|
|
@@ -188,6 +192,8 @@ Isn't it exciting?
|
|
188
192
|
```
|
189
193
|
require 'egison'
|
190
194
|
|
195
|
+
include Egison
|
196
|
+
|
191
197
|
def poker_hands cs
|
192
198
|
match(cs) do
|
193
199
|
with(Multiset.(_[_s, _n], _[__s, __("n+1")], _[__s, __("n+2")], _[__s, __("n+3")], _[__s, __("n+4")])) do
|
@@ -235,6 +241,8 @@ I believe it is also a really exciting demonstration.
|
|
235
241
|
require 'egison'
|
236
242
|
require 'prime'
|
237
243
|
|
244
|
+
include Egison
|
245
|
+
|
238
246
|
twin_primes = match_stream(Prime) {
|
239
247
|
with(List.(*_, _x, __("x + 2"), *_)) {
|
240
248
|
[x, x + 2]
|
@@ -254,7 +262,6 @@ Egison is the pattern-matching oriented pure functional programming language.
|
|
254
262
|
Actually, the original pattern-matching system of Egison is more powerful.
|
255
263
|
For example, we can do following things in the original Egison.
|
256
264
|
|
257
|
-
- We can pattern-match against infinite lists.
|
258
265
|
- We can define new pattern-constructors.
|
259
266
|
- We can modularize useful patterns.
|
260
267
|
|
data/lib/egison/core.rb
CHANGED
data/lib/egison/version.rb
CHANGED
data/sample/combination.rb
CHANGED
data/sample/join.rb
CHANGED
data/sample/poker_hands.rb
CHANGED
data/sample/set.rb
CHANGED
data/sample/stream.rb
CHANGED
data/spec/sample/join_spec.rb
CHANGED
data/spec/sample/set_spec.rb
CHANGED
data/spec/sample/stream_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: egison
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Satoshi Egi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|