klam 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.asciidoc +6 -0
- data/lib/klam/absvector.rb +13 -0
- data/lib/klam/version.rb +1 -1
- data/spec/unit/klam/absvector_spec.rb +25 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 462ec6cdadf1b62a21f9aa9fd1234e1602bd7ce8
|
4
|
+
data.tar.gz: 40a63f674eede22654c41ff77c7ccd341e52a68e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cdbfc50ed2c3ce0e41d5e003adf4f431c8a96e3cc36b704515aa2efba5fe7d335ea95abc99140b9b0ff796b82f2f4c04bc910330a5a2d5d578ef7e26e832a81
|
7
|
+
data.tar.gz: 01fca217423bb4e6314ab207a894dbc4d662c5463a7a6cfed97c0bb183e294a45fe37d458093fd8043c7dc9d195bbf4d364b49e2d3daf0eb521abe656d2acb2c
|
data/HISTORY.asciidoc
CHANGED
data/lib/klam/absvector.rb
CHANGED
@@ -18,5 +18,18 @@ module Klam
|
|
18
18
|
self[i] = x
|
19
19
|
self
|
20
20
|
end
|
21
|
+
|
22
|
+
# In Shen, the data types that are implemented on top of absvectors
|
23
|
+
# use index 0 for auxilliary information. To ease interop scenarios,
|
24
|
+
# to_a and each are overridden to skip the first slot.
|
25
|
+
def each(&blk)
|
26
|
+
to_a.each(&blk)
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_a
|
30
|
+
a = super
|
31
|
+
a.shift
|
32
|
+
a
|
33
|
+
end
|
21
34
|
end
|
22
35
|
end
|
data/lib/klam/version.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Klam::Absvector do
|
4
|
+
describe '#to_a' do
|
5
|
+
it 'skips the first element' do
|
6
|
+
a = Klam::Absvector.new(3)
|
7
|
+
a[0] = 1
|
8
|
+
a[1] = 2
|
9
|
+
a[2] = 3
|
10
|
+
expect(a.to_a).to eq([2,3])
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#each' do
|
15
|
+
it 'skips the first element' do
|
16
|
+
a = Klam::Absvector.new(3)
|
17
|
+
a[0] = 1
|
18
|
+
a[1] = 2
|
19
|
+
a[2] = 3
|
20
|
+
b = []
|
21
|
+
a.each { |x| b << x }
|
22
|
+
expect(b).to eq([2,3])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: klam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Spurrier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01
|
11
|
+
date: 2015-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -158,6 +158,7 @@ files:
|
|
158
158
|
- spec/functional/primitives/generic_functions_spec.rb
|
159
159
|
- spec/functional/tail_call_optimization_spec.rb
|
160
160
|
- spec/spec_helper.rb
|
161
|
+
- spec/unit/klam/absvector_spec.rb
|
161
162
|
- spec/unit/klam/compilation_stages/convert_lexical_variables_spec.rb
|
162
163
|
- spec/unit/klam/compilation_stages/convert_self_tail_calls_to_loops_spec.rb
|
163
164
|
- spec/unit/klam/compilation_stages/curry_abstraction_applications_spec.rb
|
@@ -211,6 +212,7 @@ test_files:
|
|
211
212
|
- spec/functional/primitives/generic_functions_spec.rb
|
212
213
|
- spec/functional/tail_call_optimization_spec.rb
|
213
214
|
- spec/spec_helper.rb
|
215
|
+
- spec/unit/klam/absvector_spec.rb
|
214
216
|
- spec/unit/klam/compilation_stages/convert_lexical_variables_spec.rb
|
215
217
|
- spec/unit/klam/compilation_stages/convert_self_tail_calls_to_loops_spec.rb
|
216
218
|
- spec/unit/klam/compilation_stages/curry_abstraction_applications_spec.rb
|