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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d94f383bc1d7de65f89a238b842b70e2c33d82c6
4
- data.tar.gz: a2f2c7ee6140a51f3a5ea060d4211076c7f4b61e
2
+ SHA256:
3
+ metadata.gz: 378523b0249fe580ce581ba771a6fb89e1b9e8845489629b81930adecccf2907
4
+ data.tar.gz: de3a44c40bb82810c3dbaa7b97d70de40d8d0149c157bc97fdd7e74c8e4e44cb
5
5
  SHA512:
6
- metadata.gz: ca7c1d2590e6f3dec7a02345e36c8d8fe01df89aa601727e490ead32099c76e858f23a7e6caa49dd37dc144d07cc70a7a1bbe7559efdfb04437ac2e3e8fa0a81
7
- data.tar.gz: 8cc56c1209d30ce0470f5281bad9b17cabdd8515f4126881c5bf7815f1fb94e73fc2d73ce33f84826291f0b0c8f2ac7498adfd1c7da8b879519fb0ed20b41e05
6
+ metadata.gz: 6189770ed0e2cd852d30a80d87ff9947c43a7c43afa64f4673ca1ce7208d5967b864a6e62dc9a20fd9ad0ca3115e6f31e77058038bf7c4f523f110dcae50a162
7
+ data.tar.gz: 6fe2efbf1e8618df9af68c08ea62abbb4cb66d52a45019be4f6e5961be418044a60091e41e1c7fad4da27d1d396e23ae4bb2e6fb6b52dca89b8db0f1f395c748
@@ -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`
@@ -1,5 +1,5 @@
1
1
  version: '{build}'
2
- max_jobs: 5
2
+ max_jobs: 3
3
3
  environment:
4
4
  matrix:
5
5
  - Ruby_version: 25-x64
@@ -73,21 +73,21 @@
73
73
  (define list
74
74
  (lambda args args))
75
75
 
76
- ; (define caar
77
- ; (lambda (x)
78
- ; (car (car x))))
76
+ (define caar
77
+ (lambda (x)
78
+ (car (car x))))
79
79
 
80
- ; (define cadr
81
- ; (lambda (x)
82
- ; (car (cdr x))))
80
+ (define cadr
81
+ (lambda (x)
82
+ (car (cdr x))))
83
83
 
84
- ;(define cdar
85
- ; (lambda(x)
86
- ; (cdr (car x))))
84
+ (define cdar
85
+ (lambda(x)
86
+ (cdr (car x))))
87
87
 
88
- ;(define cddr
89
- ; (lambda (x)
90
- ; (cdr (cdr x))))
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
@@ -1,3 +1,3 @@
1
1
  module Skeem
2
- VERSION = '0.1.02'.freeze
2
+ VERSION = '0.1.03'.freeze
3
3
  end
@@ -63,6 +63,6 @@ if RUBY_VERSION <= '2.2'
63
63
  else
64
64
  spec.add_development_dependency 'bundler', '~> 2.0'
65
65
  end
66
- spec.add_development_dependency 'rake', '~> 10.0'
66
+ spec.add_development_dependency 'rake', '~> 12.0'
67
67
  spec.add_development_dependency 'rspec', '~> 3.0'
68
68
  end
@@ -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.02
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-13 00:00:00.000000000 Z
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: '10.0'
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: '10.0'
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: |2
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
- rubyforge_project:
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