skeem 0.1.02 → 0.1.03
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/appveyor.yml +1 -1
- data/lib/skeem/standard/base.skm +12 -12
- data/lib/skeem/version.rb +1 -1
- data/skeem.gemspec +1 -1
- data/spec/skeem/interpreter_spec.rb +42 -0
- metadata +6 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 378523b0249fe580ce581ba771a6fb89e1b9e8845489629b81930adecccf2907
|
4
|
+
data.tar.gz: de3a44c40bb82810c3dbaa7b97d70de40d8d0149c157bc97fdd7e74c8e4e44cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6189770ed0e2cd852d30a80d87ff9947c43a7c43afa64f4673ca1ce7208d5967b864a6e62dc9a20fd9ad0ca3115e6f31e77058038bf7c4f523f110dcae50a162
|
7
|
+
data.tar.gz: 6fe2efbf1e8618df9af68c08ea62abbb4cb66d52a45019be4f6e5961be418044a60091e41e1c7fad4da27d1d396e23ae4bb2e6fb6b52dca89b8db0f1f395c748
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [0.1.03] - 2019-01-15
|
2
|
+
### Added
|
3
|
+
- File `base.skm` implementation of list procedures: `caar`, `cadr`, `cdar`, `cddr`
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
- File `interpreter_spec.rb` added spec examples to test the new procedures.
|
7
|
+
- File `README.md` added allusion to new procedures?
|
8
|
+
|
1
9
|
## [0.1.02] - 2019-01-13
|
2
10
|
### Added
|
3
11
|
- File `primitive_builder.rb` implementation of: `equal?`, `make-vector`, `symbol->string` procedures.
|
data/README.md
CHANGED
@@ -178,7 +178,7 @@ This section lists the implemented standard procedures
|
|
178
178
|
* Integer-level: `even?`, `odd?`
|
179
179
|
|
180
180
|
#### List procedures
|
181
|
-
* `list?`, `null?`, `pair?`, `car`, `cdr`, `cons`, `length`, `list`, `list->vector`, `set-car!`, `set-cdr!`
|
181
|
+
* `list?`, `null?`, `pair?`, `car`, `cdr`, `caar`, `cadr`, `cdar`, `cddr`, `cons`, `length`, `list`, `list->vector`, `set-car!`, `set-cdr!`
|
182
182
|
|
183
183
|
#### String procedures
|
184
184
|
* `string?`, `string=?`, `string-append`, `string-length`, `string->symbol`
|
data/appveyor.yml
CHANGED
data/lib/skeem/standard/base.skm
CHANGED
@@ -73,21 +73,21 @@
|
|
73
73
|
(define list
|
74
74
|
(lambda args args))
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
(define caar
|
77
|
+
(lambda (x)
|
78
|
+
(car (car x))))
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
(define cadr
|
81
|
+
(lambda (x)
|
82
|
+
(car (cdr x))))
|
83
83
|
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
(define cdar
|
85
|
+
(lambda(x)
|
86
|
+
(cdr (car x))))
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
88
|
+
(define cddr
|
89
|
+
(lambda (x)
|
90
|
+
(cdr (cdr x))))
|
91
91
|
|
92
92
|
;; (list-ref list n)
|
93
93
|
;; Return the nth (sero-based) element of list
|
data/lib/skeem/version.rb
CHANGED
data/skeem.gemspec
CHANGED
@@ -600,6 +600,48 @@ SKEEM
|
|
600
600
|
end
|
601
601
|
end
|
602
602
|
|
603
|
+
it 'should implement the caar procedure' do
|
604
|
+
checks = [
|
605
|
+
["(caar '((a)))", 'a'],
|
606
|
+
["(caar '((1 2) 3 4))", 1]
|
607
|
+
]
|
608
|
+
checks.each do |(skeem_expr, expectation)|
|
609
|
+
result = subject.run(skeem_expr)
|
610
|
+
expect(result).to eq(expectation)
|
611
|
+
end
|
612
|
+
end
|
613
|
+
|
614
|
+
it 'should implement the cadr procedure' do
|
615
|
+
checks = [
|
616
|
+
["(cadr '(a b c))", 'b'],
|
617
|
+
["(cadr '((1 2) 3 4))", 3]
|
618
|
+
]
|
619
|
+
checks.each do |(skeem_expr, expectation)|
|
620
|
+
result = subject.run(skeem_expr)
|
621
|
+
expect(result).to eq(expectation)
|
622
|
+
end
|
623
|
+
end
|
624
|
+
|
625
|
+
it 'should implement the cdar procedure' do
|
626
|
+
checks = [
|
627
|
+
["(cdar '((7 6 5 4 3 2 1) 8 9))", [6, 5, 4, 3, 2, 1]]
|
628
|
+
]
|
629
|
+
checks.each do |(skeem_expr, expectation)|
|
630
|
+
result = subject.run(skeem_expr)
|
631
|
+
expect(result.to_a).to eq(expectation)
|
632
|
+
end
|
633
|
+
end
|
634
|
+
|
635
|
+
it 'should implement the cddr procedure' do
|
636
|
+
checks = [
|
637
|
+
["(cddr '(2 1))", []]
|
638
|
+
]
|
639
|
+
checks.each do |(skeem_expr, expectation)|
|
640
|
+
result = subject.run(skeem_expr)
|
641
|
+
expect(result.to_a).to eq(expectation)
|
642
|
+
end
|
643
|
+
end
|
644
|
+
|
603
645
|
it 'should implement the symbol=? procedure' do
|
604
646
|
checks = [
|
605
647
|
["(symbol=? 'a 'a)", true],
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skeem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.03
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitri Geshef
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rley
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '12.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '12.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,8 +66,7 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
|
-
description:
|
70
|
-
Skeem is a Scheme language interpreter implemented in Ruby.
|
69
|
+
description: " Skeem is a Scheme language interpreter implemented in Ruby.\n"
|
71
70
|
email:
|
72
71
|
- famished.tiger@yahoo.com
|
73
72
|
executables: []
|
@@ -145,8 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
144
|
- !ruby/object:Gem::Version
|
146
145
|
version: '0'
|
147
146
|
requirements: []
|
148
|
-
|
149
|
-
rubygems_version: 2.6.13
|
147
|
+
rubygems_version: 3.0.2
|
150
148
|
signing_key:
|
151
149
|
specification_version: 4
|
152
150
|
summary: Skeem is an interpreter of a subset of the Scheme programming language. Scheme
|