lisp-interpreter 0.1.0 → 0.2.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: b05bfd3f510fb947e037a1de118289cd36f77f37
4
- data.tar.gz: de9c23f86e55ef264e44a1e54bee0282dc83ee51
3
+ metadata.gz: cdf872d493fc81d79bca68b298c725f4a4ea0976
4
+ data.tar.gz: '0196ca2dcc427290d7834ebc083e99f944339b8c'
5
5
  SHA512:
6
- metadata.gz: b83a05bd09ad2d0f92b23b47e10f35810dfff583281357bf14980b299c10877d1cf91ec565bb58cab8c3611dc475353603ebd4571bdde65260f3d81b740595cd
7
- data.tar.gz: f6b0962fec13104184464a03c60663393ef6858e8eb2f8aeb31dfa4c482cb9605a7868c682cb2cbca8c3954aa8445ea238be5f066ab6a9aef6aea38085658a14
6
+ metadata.gz: e4a71d36f48baa147d86a7bacd6eca2b422ec4ad985c0c12b41c0003691accb9e95fbfa711d1be3717a8701f381e681fa0698cf071efc7b31f1062a69c2d5266
7
+ data.tar.gz: e31700583f19cc9b9e494cdd08f636490e38eb988a3003de2e320ca76caeafc25f12ee838f005cc24a8b7e50cbede92884267f05885cfba09f6fef01f507bd8c
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/zaki1993#{Ruby-Project/lisp-interpreter}" }
3
+ git_source(:github) {|repo_name| "https://github.com/zaki1993/Ruby-Project/lisp-interpreter" }
4
4
 
5
5
  # Specify your gem's dependencies in lisp-interpreter.gemspec
6
6
  gemspec
data/README.md CHANGED
@@ -162,7 +162,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
162
162
 
163
163
  ## Contributing
164
164
 
165
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lisp-interpreter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
165
+ Bug reports and pull requests are welcome on GitHub at https://github.com/zaki1993/Ruby-Project/lisp-interpreter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
166
166
 
167
167
  ## License
168
168
 
@@ -170,4 +170,4 @@ The gem is available as open source under the terms of the [MIT License](http://
170
170
 
171
171
  ## Code of Conduct
172
172
 
173
- Everyone interacting in the Lisp::Interpreter project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/lisp-interpreter/blob/master/CODE_OF_CONDUCT.md).
173
+ Everyone interacting in the Lisp::Interpreter project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/zaki1993/Ruby-Project/lisp-interpreter/blob/master/CODE_OF_CONDUCT.md).
@@ -53,10 +53,16 @@ module Optimize
53
53
  send func, values
54
54
  end
55
55
 
56
- def call_compose(other)
56
+ def call_compose_helper(other)
57
57
  tmp = ['(', *other[1..-1]]
58
58
  idx = find_bracket_idx tmp, 0
59
59
  funcs = find_all_values tmp[1..idx - 1]
60
+ raise '' if tmp[idx + 1..-1].empty?
61
+ [funcs, idx, tmp]
62
+ end
63
+
64
+ def call_compose(other)
65
+ funcs, idx, tmp = call_compose_helper other
60
66
  value, = find_next_value tmp[idx + 1..-1]
61
67
  funcs.reverse.each do |t|
62
68
  value = calc_input_val ['(', t, value.to_s, ')']
@@ -267,6 +273,7 @@ module FunctionalScheme
267
273
  end
268
274
 
269
275
  def define(other)
276
+ raise 'Incorrect number of arguments' if other.size < 2
270
277
  fetch_define other
271
278
  end
272
279
  end
@@ -148,7 +148,9 @@ module SchemeLists
148
148
  end
149
149
 
150
150
  def map(other)
151
+ raise 'Incorrect number of arguments' if other.empty?
151
152
  func, other = valid_function other
153
+ raise 'Incorrect number of arguments' if other.empty?
152
154
  lst = find_all_values other
153
155
  lst = lst.map { |t| find_list_function_value [t] }
154
156
  lst = (equalize_lists lst).transpose
@@ -15,13 +15,13 @@ class Parser
15
15
  include Environment
16
16
 
17
17
  def initialize(env_type = Environment::TEST)
18
- @ENV_TYPE = env_type
18
+ @env_type = env_type
19
19
  @tokenizer = Tokenizer.new
20
20
  end
21
21
 
22
22
  def run
23
23
  loop do
24
- print 'zakichan> ' if @ENV_TYPE == Environment::PROD
24
+ print 'zakichan> ' if @env_type == Environment::PROD
25
25
  token = ''
26
26
  until (validate_token token).nil? && token != ''
27
27
  crr_input = STDIN.gets.chomp
@@ -66,7 +66,7 @@ class Parser
66
66
  def print_result(result)
67
67
  to_remove = result.to_s.list? || result.to_s.pair? || result.to_s.quote?
68
68
  result = result.delete('\'') if to_remove
69
- puts result if @ENV_TYPE == Environment::PROD
69
+ puts result if @env_type == Environment::PROD
70
70
  result
71
71
  end
72
72
  end
@@ -1,5 +1,5 @@
1
1
  module Lisp
2
2
  module Interpreter
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lisp-interpreter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zaki Petrov
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  requirements: []
111
111
  rubyforge_project:
112
- rubygems_version: 2.5.2
112
+ rubygems_version: 2.6.12
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: Lisp interpreter gem