egison 0.4.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 146ed0f768555e2dc73b59c7468dc1d2dd0cfa6a
4
- data.tar.gz: 8d4a4486865bff5cca675ac45117443b2da7e665
3
+ metadata.gz: 94a489dfeb3722cf74e46e867076fec46fb389b7
4
+ data.tar.gz: 9b115c122986dd02864a4b25a7754273f4eadd9d
5
5
  SHA512:
6
- metadata.gz: dd3b48d5efa466113bae4eca3eb6e2f0bc5efb9405783a95f3d91bdad65d7b15a7aa4aad8d4859a36eebc3d30df245fa093a5caa69d3312d35069a5747965ccd
7
- data.tar.gz: bd41119e0da423aa3b9fb66ca69c6bf03d25bb8e7a81fe9030de230ded0ffd7e10e82ab09f236e9d828c9ccf6de1abed9452322b3bfef697979daf2196aff144
6
+ metadata.gz: 896c6d1ad74e28517083ae6cfea6465895f1af804c5fbf51da7c291b51f16effdc120e0a50e5325b61273490e71ebd71b1e46924e3eb34ff2906c0eca2cd12f6
7
+ data.tar.gz: bb189940c54dcb19358b5d30b2e94b48d3e262fb2ec22f0c6e7e28299a0ed2853f50e935090f0f45d70266b82e351bfab15e7cdde854e87c4422b752c3aaf7ef
data/README.md CHANGED
@@ -258,7 +258,11 @@ You can find more demonstrations in the [`sample`](https://github.com/egison/egi
258
258
  ## About Egison
259
259
 
260
260
  If you get to love the above pattern-matching, please try [the Egison programming language](http://www.egison.org), too.
261
- Egison is the pattern-matching oriented pure functional programming language.
261
+ <<<<<<< HEAD
262
+ Egison is the pattern-matching oriented, purely functional programming language.
263
+ =======
264
+ Egison is the pattern-matching oriented purely functional programming language.
265
+ >>>>>>> 39ede8d0f3300244c240fce2d8069dda3a2f065e
262
266
  Actually, the original pattern-matching system of Egison is more powerful.
263
267
  For example, we can do following things in the original Egison.
264
268
 
@@ -269,7 +273,7 @@ There is a new programming world!
269
273
 
270
274
  ## Contact
271
275
 
272
- If you get interested in this Gem, please mail to [Satoshi Egi](http://www.egison.org/~egi/) or tweet to [@Egison_Lang](https://twitter.com/Egison_Lang).
276
+ If you get interested in this Gem, please contact [Satoshi Egi](http://www.egison.org/~egi/) or tweet to [@Egison_Lang](https://twitter.com/Egison_Lang).
273
277
 
274
278
  ## LICENSE
275
279
 
@@ -50,33 +50,26 @@ module PatternMatch
50
50
 
51
51
  class MatchingStateStream
52
52
  def initialize(pat, tgt)
53
- @states = [MatchingState.new(pat, tgt)]
53
+ @state = MatchingState.new(pat, tgt)
54
54
  @processes = []
55
55
  end
56
56
 
57
57
  def match(&block)
58
- state = @states.shift
59
- @processes << Egison::LazyArray.new(state.process_stream)
60
- until @states.empty? && @processes.empty?
61
- unless @processes.empty?
62
- process(@processes.shift, &block)
63
- end
64
- unless @states.empty?
65
- state = @states.shift
66
- process(Egison::LazyArray.new(state.process_stream), &block)
67
- end
58
+ @processes << Egison::LazyArray.new(@state.process_stream)
59
+ until @processes.empty?
60
+ process(@processes.shift, &block)
68
61
  end
69
62
  end
70
63
 
71
64
  def process(process_iter, &block)
72
65
  unless process_iter.empty?
73
- @processes << process_iter
74
66
  ret = process_iter.shift
75
67
  if ret.atoms.empty?
76
68
  block.(ret.bindings)
77
69
  else
78
- @states << ret
70
+ @processes << Egison::LazyArray.new(ret.process_stream)
79
71
  end
72
+ @processes << process_iter
80
73
  end
81
74
  end
82
75
  end
@@ -332,7 +325,7 @@ module PatternMatch
332
325
  uscore = Wildcard.new()
333
326
  class << uscore
334
327
  def [](*args)
335
- List.call(*args)
328
+ Egison::List.call(*args)
336
329
  end
337
330
  end
338
331
  uscore
@@ -417,11 +410,11 @@ module PatternMatch
417
410
  ctx = @ctx
418
411
  tgt = @tgt
419
412
  mstack = MatchingStateStream.new(pat,tgt)
420
- ::Enumerator.new do |y|
413
+ ::Egison::LazyArray.new(::Enumerator.new{|y|
421
414
  mstack.match do |bindings|
422
415
  y << with_bindings(ctx, bindings, &block)
423
416
  end
424
- end
417
+ })
425
418
  rescue PatternNotMatch
426
419
  end
427
420
  end
@@ -150,7 +150,7 @@ module Egison
150
150
  end
151
151
 
152
152
  def inspect
153
- "\#<#{self.class.name}#{@terminated ? @cache.inspect : "[#{@cache.join(', ')}...]"}>"
153
+ "\#<#{self.class.name}#{@terminated ? @cache.inspect : "[#{@cache.map(&:inspect).join(', ')}...]"}>"
154
154
  end
155
155
  end
156
156
  end
@@ -24,54 +24,58 @@ class Class
24
24
  end
25
25
  end
26
26
 
27
- class List
28
- end
29
-
30
- class << List
31
- def uncons(val)
32
- accept_array_only(val)
33
- val2 = val.clone
34
- x = val2.shift
35
- [[x, val2]]
27
+ module Egison
28
+ extend self
29
+
30
+ class List
36
31
  end
37
32
 
38
- def uncons_stream(val, &block)
39
- if !(val.kind_of?(Array) || val.kind_of?(Egison::LazyArray))
40
- val = test_conv_lazy_array(val)
33
+ class << List
34
+ def uncons(val)
35
+ accept_array_only(val)
36
+ val2 = val.clone
37
+ x = val2.shift
38
+ [[x, val2]]
41
39
  end
42
- val2 = val.clone
43
- x = val2.shift
44
- block.([x, val2])
45
- end
46
40
 
47
- def unjoin(val)
48
- accept_array_only(val)
49
- val2 = val.clone
50
- xs = []
51
- ys = val2.clone
52
- rets = [[xs, ys]]
53
- until val2.empty? do
41
+ def uncons_stream(val, &block)
42
+ if !(val.kind_of?(Array) || val.kind_of?(Egison::LazyArray))
43
+ val = test_conv_lazy_array(val)
44
+ end
45
+ val2 = val.clone
54
46
  x = val2.shift
55
- ys = val2.clone
56
- xs += [x]
57
- rets += [[xs, ys]]
47
+ block.([x, val2])
58
48
  end
59
- rets
60
- end
61
49
 
62
- def unjoin_stream(val, &block)
63
- if !(val.kind_of?(Array) || val.kind_of?(Egison::LazyArray))
64
- val = test_conv_lazy_array(val)
50
+ def unjoin(val)
51
+ accept_array_only(val)
52
+ val2 = val.clone
53
+ xs = []
54
+ ys = val2.clone
55
+ rets = [[xs, ys]]
56
+ until val2.empty? do
57
+ x = val2.shift
58
+ ys = val2.clone
59
+ xs += [x]
60
+ rets += [[xs, ys]]
61
+ end
62
+ rets
65
63
  end
66
- val2 = val.clone
67
- xs = []
68
- ys = val2.clone
69
- block.([xs, ys])
70
- until val2.empty?
71
- x = val2.shift
64
+
65
+ def unjoin_stream(val, &block)
66
+ if !(val.kind_of?(Array) || val.kind_of?(Egison::LazyArray))
67
+ val = test_conv_lazy_array(val)
68
+ end
69
+ val2 = val.clone
70
+ xs = []
72
71
  ys = val2.clone
73
- xs += [x]
74
72
  block.([xs, ys])
73
+ until val2.empty?
74
+ x = val2.shift
75
+ ys = val2.clone
76
+ xs += [x]
77
+ block.([xs, ys])
78
+ end
75
79
  end
76
80
  end
77
81
  end
@@ -3,123 +3,125 @@ require 'egison/lazyarray'
3
3
  require 'egison/matcher-core'
4
4
  require 'set'
5
5
 
6
- class Multiset
7
- end
6
+ module Egison
7
+ extend self
8
+
9
+ class Multiset
10
+ end
8
11
 
9
- class << Multiset
10
- def uncons(val)
11
- accept_array_only(val)
12
- match_all(val) do
13
- with(List.(*_hs, _x, *_ts)) do
14
- [x, hs + ts]
12
+ class << Multiset
13
+ def uncons(val)
14
+ accept_array_only(val)
15
+ match_all(val) do
16
+ with(List.(*_hs, _x, *_ts)) do
17
+ [x, hs + ts]
18
+ end
15
19
  end
16
20
  end
17
- end
18
21
 
19
- def uncons_stream(val, &block)
20
- if !(val.kind_of?(Array) || val.kind_of?(Egison::LazyArray))
21
- val = test_conv_lazy_array(val)
22
- end
23
- stream = match_stream(val) {
24
- with(List.(*_hs, _x, *_ts)) do
25
- [x, hs + ts]
22
+ def uncons_stream(val, &block)
23
+ if !(val.kind_of?(Array) || val.kind_of?(Egison::LazyArray))
24
+ val = test_conv_lazy_array(val)
26
25
  end
27
- }
28
- stream.each(&block)
29
- end
26
+ stream = match_stream(val) {
27
+ with(List.(*_hs, _x, *_ts)) do
28
+ [x, hs + ts]
29
+ end
30
+ }
31
+ stream.each(&block)
32
+ end
30
33
 
31
- def unjoin(val)
32
- accept_array_only(val)
33
- val2 = val.clone
34
- xs = []
35
- ys = val2.clone
36
- rets = [[xs, ys]]
37
- if val2.empty?
38
- rets
39
- else
40
- x = val2.shift
34
+ def unjoin(val)
35
+ accept_array_only(val)
36
+ val2 = val.clone
37
+ xs = []
41
38
  ys = val2.clone
42
- rets2 = unjoin(ys)
43
- rets = (rets2.map { |xs2, ys2| [xs2, [x] + ys2] }) + (rets2.map { |xs2, ys2| [[x] + xs2, ys2] })
44
- rets
39
+ rets = [[xs, ys]]
40
+ if val2.empty?
41
+ rets
42
+ else
43
+ x = val2.shift
44
+ ys = val2.clone
45
+ rets2 = unjoin(ys)
46
+ rets = (rets2.map { |xs2, ys2| [xs2, [x] + ys2] }) + (rets2.map { |xs2, ys2| [[x] + xs2, ys2] })
47
+ rets
48
+ end
45
49
  end
46
- end
47
50
 
48
- def unjoin_stream(val, &block)
49
- if !(val.kind_of?(Array) || val.kind_of?(Egison::LazyArray))
50
- val = test_conv_lazy_array(val)
51
- end
52
- val2 = val.clone
53
- xs = []
54
- ys = val2.clone
55
- if val2.empty?
56
- block.([xs, ys])
57
- else
58
- x = val2.shift
51
+ def unjoin_stream(val, &block)
52
+ if !(val.kind_of?(Array) || val.kind_of?(Egison::LazyArray))
53
+ val = test_conv_lazy_array(val)
54
+ end
55
+ val2 = val.clone
56
+ xs = []
59
57
  ys = val2.clone
60
- rets_stream = Egison::LazyArray.new(to_enum(:unjoin_stream, ys))
61
- # rets_stream.each{|xs2, ys2| block.([xs2, [x] + ys2])}
62
- rets_stream.each{|xs2, ys2| block.([xs2, ys2.clone.unshift(x)])}
63
- # rets_stream.each{|xs2, ys2| block.([[x] + xs2, ys2])}
64
- rets_stream.each{|xs2, ys2| block.([xs2.clone.unshift(x), ys2])}
58
+ block.([xs, ys])
59
+ unless val2.empty?
60
+ x = val2.shift
61
+ ys = val2.clone
62
+ unjoin_stream(ys) do |xs2, ys2|
63
+ block.([xs2, [x] + ys2]) unless xs2.empty?
64
+ block.([[x] + xs2, ys2])
65
+ end
66
+ end
65
67
  end
66
68
  end
67
- end
68
69
 
69
- class << Set
70
- def uncons(val)
71
- accept_array_only(val)
72
- match_all(val) do
73
- with(List.(*_, _x, *_)) do
74
- [x, val]
70
+ class << Set
71
+ def uncons(val)
72
+ accept_array_only(val)
73
+ match_all(val) do
74
+ with(List.(*_, _x, *_)) do
75
+ [x, val]
76
+ end
75
77
  end
76
78
  end
77
- end
78
79
 
79
- def uncons_stream(val, &block)
80
- if !(val.kind_of?(Array) || val.kind_of?(Egison::LazyArray))
81
- val = test_conv_lazy_array(val)
82
- end
83
- stream = match_stream(val) {
84
- with(List.(*_, _x, *_)) do
85
- [x, val]
80
+ def uncons_stream(val, &block)
81
+ if !(val.kind_of?(Array) || val.kind_of?(Egison::LazyArray))
82
+ val = test_conv_lazy_array(val)
86
83
  end
87
- }
88
- stream.each(&block)
89
- end
90
-
91
- def unjoin(val)
92
- accept_array_only(val)
93
- val2 = val.clone
94
- xs = []
95
- ys = val2.clone
96
- rets = [[xs, ys]]
97
- if val2.empty?
98
- rets
99
- else
100
- x = val2.shift
101
- ys2 = val2.clone
102
- rets2 = unjoin(ys2)
103
- rets = (rets2.map { |xs2, _| [xs2, ys] }) + (rets2.map { |xs2, ys2| [[x] + xs2, ys] })
104
- rets
84
+ stream = match_stream(val) {
85
+ with(List.(*_, _x, *_)) do
86
+ [x, val]
87
+ end
88
+ }
89
+ stream.each(&block)
105
90
  end
106
- end
107
91
 
108
- def unjoin_stream(val, &block)
109
- if !(val.kind_of?(Array) || val.kind_of?(Egison::LazyArray))
110
- val = test_conv_lazy_array(val)
92
+ def unjoin(val)
93
+ accept_array_only(val)
94
+ val2 = val.clone
95
+ xs = []
96
+ ys = val2.clone
97
+ rets = [[xs, ys]]
98
+ if val2.empty?
99
+ rets
100
+ else
101
+ x = val2.shift
102
+ ys2 = val2.clone
103
+ rets2 = unjoin(ys2)
104
+ rets = (rets2.map { |xs2, _| [xs2, ys] }) + (rets2.map { |xs2, ys2| [[x] + xs2, ys] })
105
+ rets
106
+ end
111
107
  end
112
- val2 = val.clone
113
- xs = []
114
- ys = val2.clone
115
- if val2.empty?
108
+
109
+ def unjoin_stream(val, &block)
110
+ if !(val.kind_of?(Array) || val.kind_of?(Egison::LazyArray))
111
+ val = test_conv_lazy_array(val)
112
+ end
113
+ val2 = val.clone
114
+ xs = []
115
+ ys = val2.clone
116
116
  block.([xs, ys])
117
- else
118
- x = val2.shift
119
- ys2 = val2.clone
120
- rets_stream = Egison::LazyArray.new(to_enum(:unjoin_stream, ys2))
121
- rets_stream.each{|xs2, _| block.([xs2, ys])}
122
- rets_stream.each{|xs2, _| block.([xs2.clone.unshift(x), ys])}
117
+ unless val2.empty?
118
+ x = val2.shift
119
+ ys2 = val2.clone
120
+ unjoin_stream(ys2) do |xs2, _|
121
+ block.([xs2, ys]) unless xs2.empty?
122
+ block.([[x] + xs2, ys])
123
+ end
124
+ end
123
125
  end
124
126
  end
125
127
  end
@@ -1,3 +1,3 @@
1
1
  module Egison
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+ require 'egison'
3
+
4
+ include Egison
5
+
6
+ def nats
7
+ (1..Float::INFINITY)
8
+ end
9
+
10
+ describe "sample" do
11
+ describe "join_stream.rb" do
12
+ # (take 30 (match-all nats (list integer) [<join $hs <join $ts _>> [hs ts]]))
13
+ # => {[{} {}] [{} {1}] [{1} {}] [{} {1 2}] [{1} {2}] [{1 2} {}] [{} {1 2 3}] [{1} {2 3}] [{1 2} {3}] [{1 2 3} {}] [{} {1 2 3 4}] [{1} {2 3 4}] [{1 2} {3 4}] [{1 2 3} {4}] [{1 2 3 4} {}] [{} {1 2 3 4 5}] [{1} {2 3 4 5}] [{1 2} {3 4 5}] [{1 2 3} {4 5}] [{1 2 3 4} {5}] [{1 2 3 4 5} {}] [{} {1 2 3 4 5 6}] [{1} {2 3 4 5 6}] [{1 2} {3 4 5 6}] [{1 2 3} {4 5 6}] [{1 2 3 4} {5 6}] [{1 2 3 4 5} {6}] [{1 2 3 4 5 6} {}] [{} {1 2 3 4 5 6 7}] [{1} {2 3 4 5 6 7}]}
14
+ # v- same result as above
15
+ it %q{match_stream(nats) { with(List.(*_hs, *_ts, *_)) { [hs, ts] } }.take(30)} do
16
+ expect(match_stream(nats) { with(List.(*_hs, *_ts, *_)) { [hs, ts] } }.take(30)).to eq \
17
+ [[[], []], [[], [1]], [[1], []], [[], [1, 2]], [[1], [2]], [[1, 2], []], [[], [1, 2, 3]], [[1], [2, 3]], [[1, 2], [3]], [[1, 2, 3], []], [[], [1, 2, 3, 4]], [[1], [2, 3, 4]], [[1, 2], [3, 4]], [[1, 2, 3], [4]], [[1, 2, 3, 4], []], [[], [1, 2, 3, 4, 5]], [[1], [2, 3, 4, 5]], [[1, 2], [3, 4, 5]], [[1, 2, 3], [4, 5]], [[1, 2, 3, 4], [5]], [[1, 2, 3, 4, 5], []], [[], [1, 2, 3, 4, 5, 6]], [[1], [2, 3, 4, 5, 6]], [[1, 2], [3, 4, 5, 6]], [[1, 2, 3], [4, 5, 6]], [[1, 2, 3, 4], [5, 6]], [[1, 2, 3, 4, 5], [6]], [[1, 2, 3, 4, 5, 6], []], [[], [1, 2, 3, 4, 5, 6, 7]], [[1], [2, 3, 4, 5, 6, 7]]]
18
+ end
19
+ # (take 30 (match-all nats (multiset integer) [<join $hs <join $ts _>> [hs ts]]))
20
+ # => {[{} {}] [{} {1}] [{1} {}] [{} {2}] [{1} {2}] [{2} {}] [{} {3}] [{1} {3}] [{2} {1}] [{3} {}] [{} {4}] [{1} {4}] [{2} {3}] [{3} {1}] [{4} {}] [{} {5}] [{1} {5}] [{2} {4}] [{3} {2}] [{4} {1}] [{5} {}] [{} {6}] [{1} {6}] [{2} {5}] [{3} {4}] [{4} {2}] [{5} {1}] [{6} {}] [{} {7}] [{1} {7}]}
21
+ # v- diffrent result as above, but natural
22
+ it %q{match_stream(nats) { with(Multiset.(*_hs, *_ts, *_)) { [hs, ts] } }.take(30)} do
23
+ expect(match_stream(nats) { with(Multiset.(*_hs, *_ts, *_)) { [hs, ts] } }.take(30)).to eq \
24
+ [[[], []], [[], [1]], [[1], []], [[], [2]], [[1], [2]], [[2], []], [[], [1, 2]], [[1], [3]], [[2], [1]], [[1, 2], []], [[], [3]], [[1], [2, 3]], [[2], [3]], [[1, 2], [3]], [[3], []], [[], [1, 3]], [[1], [4]], [[2], [1, 3]], [[1, 2], [4]], [[3], [1]], [[1, 3], []], [[], [2, 3]], [[1], [2, 4]], [[2], [4]], [[1, 2], [3, 4]], [[3], [2]], [[1, 3], [2]], [[2, 3], []], [[], [1, 2, 3]], [[1], [3, 4]]]
25
+ end
26
+ # (take 30 (match-all nats (set integer) [<join $hs <join $ts _>> [hs ts]]))
27
+ # => {[{} {}] [{} {1}] [{1} {}] [{} {2}] [{1} {1}] [{2} {}] [{} {3}] [{1} {2}] [{2} {1}] [{3} {}] [{} {1 2}] [{1} {3}] [{2} {2}] [{3} {1}] [{1 2} {}] [{} {4}] [{1} {1 2}] [{2} {3}] [{3} {2}] [{1 2} {1}] [{4} {}] [{} {1 3}] [{1} {4}] [{2} {1 2}] [{3} {3}] [{1 2} {2}] [{4} {1}] [{1 3} {}] [{} {2 1}] [{1} {1 3}]}
28
+ # v- diffrent result as above, but natural
29
+ it %q{match_stream(nats) { with(Set.(*_hs, *_ts, *_)) { [hs, ts] } }.take(30)} do
30
+ expect(match_stream(nats) { with(Set.(*_hs, *_ts, *_)) { [hs, ts] } }.take(30)).to eq \
31
+ [[[], []], [[], [1]], [[1], []], [[], [2]], [[1], [1]], [[2], []], [[], [1, 2]], [[1], [2]], [[2], [1]], [[1, 2], []], [[], [3]], [[1], [1, 2]], [[2], [2]], [[1, 2], [1]], [[3], []], [[], [1, 3]], [[1], [3]], [[2], [1, 2]], [[1, 2], [2]], [[3], [1]], [[1, 3], []], [[], [2, 3]], [[1], [1, 3]], [[2], [3]], [[1, 2], [1, 2]], [[3], [2]], [[1, 3], [1]], [[2, 3], []], [[], [1, 2, 3]], [[1], [2, 3]]]
32
+ end
33
+ end
34
+ end
35
+
@@ -34,10 +34,32 @@ describe "sample" do
34
34
  [[1, 2], [1, 3], [2, 1], [1, 4], [2, 3], [3, 1], [1, 5], [2, 4], [3, 2], [4, 1]]
35
35
  end
36
36
 
37
+ # (take 20 (match-all nats (multiset integer) [<cons $m <cons $n _>> [m n]]))
38
+ it %q{match_stream(nats){ with(Multiset.(_m, _n, *_)) { [m, n] } }.take(20)} do
39
+ expect(match_stream(nats){ with(Multiset.(_m, _n, *_)) { [m, n] } }.take(20)).to eq \
40
+ [[1, 2], [1, 3], [2, 1], [1, 4], [2, 3], [3, 1], [1, 5], [2, 4], [3, 2], [4, 1],
41
+ [1, 6], [2, 5], [3, 4], [4, 2], [5, 1], [1, 7], [2, 6], [3, 5], [4, 3], [5, 2]]
42
+ end
43
+
37
44
  # (take 10 (match-all nats (set integer) [<cons $m <cons $n _>> [m n]]))
38
45
  it %q{match_stream(nats){ with(Set.(_m, _n, *_)) { [m, n] } }.take(10)} do
39
46
  expect(match_stream(nats){ with(Set.(_m, _n, *_)) { [m, n] } }.take(10)).to eq \
40
47
  [[1, 1], [1, 2], [2, 1], [1, 3], [2, 2], [3, 1], [1, 4], [2, 3], [3, 2], [4, 1]]
41
48
  end
49
+
50
+ # (take 20 (match-all nats (set integer) [<cons $m <cons $n _>> [m n]]))
51
+ it %q{match_stream(nats){ with(Set.(_m, _n, *_)) { [m, n] } }.take(20)} do
52
+ expect(match_stream(nats){ with(Set.(_m, _n, *_)) { [m, n] } }.take(20)).to eq \
53
+ [[1, 1], [1, 2], [2, 1], [1, 3], [2, 2], [3, 1], [1, 4], [2, 3], [3, 2], [4, 1],
54
+ [1, 5], [2, 4], [3, 3], [4, 2], [5, 1], [1, 6], [2, 5], [3, 4], [4, 3], [5, 2]]
55
+ end
56
+
57
+ # assign to a variable, execute twice (or more), then obtain the same results. (for twin-primes)
58
+ it %q{assign to a variable, execute twice (or more), then obtain the same results. (for twin-primes)} do
59
+ tp = twin_primes
60
+ tp.take(10) # discard
61
+ expect(tp.take(10)).to eq \
62
+ [[3, 5], [5, 7], [11, 13], [17, 19], [29, 31], [41, 43], [59, 61], [71, 73], [101, 103], [107, 109]]
63
+ end
42
64
  end
43
65
  end
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.0
4
+ version: 0.5.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-19 00:00:00.000000000 Z
11
+ date: 2014-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -83,6 +83,7 @@ files:
83
83
  - spec/lib/egison_spec.rb
84
84
  - spec/sample/combination_spec.rb
85
85
  - spec/sample/join_spec.rb
86
+ - spec/sample/join_stream_spec.rb
86
87
  - spec/sample/poker_hands_spec.rb
87
88
  - spec/sample/set_spec.rb
88
89
  - spec/sample/stream_spec.rb