lisp-interpreter 0.3.2 → 0.3.3
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 +4 -4
- data/lib/lisp/interpreter/functional.rb +5 -3
- data/lib/lisp/interpreter/version.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '04861fa302be02832ee0c9046fd0cef4fcd26b23'
|
4
|
+
data.tar.gz: c9321964af29b7aba0e0cb7b9682d68f79795b68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c33ff37553a332339d73ec5120cd56922126f481d8d7aaa3ae1bd68b7919ce542e6e6bc60e57231ac43e9078fe4cd265aaedd0f54b25f5575023508519eef63b
|
7
|
+
data.tar.gz: 496f3e3511eb5e7c478c49d3e42b24586a49bb90dd001367fcf7813cc3399cda2c8cc123e47eb84f0cce1f77b44791f806f803f5058aebf454fd3a3b9905679b
|
@@ -122,7 +122,7 @@ module FunctionalSchemeHelper
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def find_params_lambda(other)
|
125
|
-
raise '
|
125
|
+
raise 'Invalid syntax' if other[0] != '('
|
126
126
|
idx = find_bracket_idx other, 0
|
127
127
|
[other[1..idx - 1], other[idx + 1..-1]]
|
128
128
|
end
|
@@ -130,7 +130,7 @@ module FunctionalSchemeHelper
|
|
130
130
|
def eval_lambda(other)
|
131
131
|
idx = find_bracket_idx other.unshift('('), 0
|
132
132
|
to_eval = other[1..idx - 1]
|
133
|
-
(proc_lambda to_eval).call(*other[idx + 1..-1])
|
133
|
+
(proc_lambda to_eval, true).call(*other[idx + 1..-1])
|
134
134
|
end
|
135
135
|
|
136
136
|
def proc_lambda_helper(other, params, args)
|
@@ -139,9 +139,11 @@ module FunctionalSchemeHelper
|
|
139
139
|
define_func_helper other.dup, params.dup, args
|
140
140
|
end
|
141
141
|
|
142
|
-
def proc_lambda(other)
|
142
|
+
def proc_lambda(other, is_call = false)
|
143
143
|
params, other = find_params_lambda other
|
144
144
|
other = fetch_inner_scope other
|
145
|
+
valid = params.all? { |t| valid_var_name t } || is_call
|
146
|
+
raise 'Invalid syntax' unless valid
|
145
147
|
to_return = other[0..1].join == '(compose' && params.empty?
|
146
148
|
return calc_input_val other if to_return
|
147
149
|
proc = proc do |*args|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lisp-interpreter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zaki Petrov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|