nydp 0.4.3 → 0.4.5

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lisp/core-010-precompile.nydp +5 -6
  3. data/lib/lisp/core-012-utils.nydp +2 -1
  4. data/lib/lisp/core-015-documentation.nydp +17 -11
  5. data/lib/lisp/core-020-utils.nydp +5 -5
  6. data/lib/lisp/core-030-syntax.nydp +29 -9
  7. data/lib/lisp/core-035-flow-control.nydp +15 -6
  8. data/lib/lisp/core-037-list-utils.nydp +22 -0
  9. data/lib/lisp/core-039-module.nydp +24 -0
  10. data/lib/lisp/core-040-utils.nydp +11 -12
  11. data/lib/lisp/core-041-string-utils.nydp +24 -0
  12. data/lib/lisp/core-042-date-utils.nydp +16 -0
  13. data/lib/lisp/core-043-list-utils.nydp +72 -50
  14. data/lib/lisp/core-080-pretty-print.nydp +50 -17
  15. data/lib/lisp/core-090-hook.nydp +13 -1
  16. data/lib/lisp/core-100-utils.nydp +82 -2
  17. data/lib/lisp/core-110-hash-utils.nydp +38 -0
  18. data/lib/lisp/core-120-settings.nydp +11 -2
  19. data/lib/lisp/core-900-benchmarking.nydp +17 -17
  20. data/lib/lisp/tests/accum-examples.nydp +28 -1
  21. data/lib/lisp/tests/at-syntax-examples.nydp +17 -0
  22. data/lib/lisp/tests/best-examples.nydp +9 -0
  23. data/lib/lisp/tests/builtin-tests.nydp +10 -0
  24. data/lib/lisp/tests/case-examples.nydp +14 -0
  25. data/lib/lisp/tests/date-examples.nydp +54 -1
  26. data/lib/lisp/tests/detect-examples.nydp +12 -0
  27. data/lib/lisp/tests/dp-examples.nydp +24 -0
  28. data/lib/lisp/tests/empty-examples.nydp +1 -1
  29. data/lib/lisp/tests/error-tests.nydp +4 -4
  30. data/lib/lisp/tests/hash-examples.nydp +17 -0
  31. data/lib/lisp/tests/list-grep-examples.nydp +40 -0
  32. data/lib/lisp/tests/list-tests.nydp +39 -0
  33. data/lib/lisp/tests/module-examples.nydp +10 -0
  34. data/lib/lisp/tests/parser-tests.nydp +16 -0
  35. data/lib/lisp/tests/pretty-print-tests.nydp +8 -2
  36. data/lib/lisp/tests/settings-examples.nydp +1 -1
  37. data/lib/lisp/tests/string-tests.nydp +48 -0
  38. data/lib/lisp/tests/syntax-tests.nydp +5 -1
  39. data/lib/nydp.rb +6 -3
  40. data/lib/nydp/assignment.rb +10 -3
  41. data/lib/nydp/builtin.rb +1 -1
  42. data/lib/nydp/builtin/abs.rb +8 -0
  43. data/lib/nydp/builtin/date.rb +9 -0
  44. data/lib/nydp/builtin/error.rb +1 -1
  45. data/lib/nydp/builtin/hash.rb +11 -1
  46. data/lib/nydp/builtin/ruby_wrap.rb +69 -0
  47. data/lib/nydp/builtin/string_pad_left.rb +7 -0
  48. data/lib/nydp/builtin/string_pad_right.rb +7 -0
  49. data/lib/nydp/builtin/type_of.rb +9 -6
  50. data/lib/nydp/closure.rb +0 -3
  51. data/lib/nydp/cond.rb +23 -1
  52. data/lib/nydp/context_symbol.rb +14 -6
  53. data/lib/nydp/core.rb +33 -29
  54. data/lib/nydp/core_ext.rb +5 -4
  55. data/lib/nydp/date.rb +17 -17
  56. data/lib/nydp/function_invocation.rb +33 -25
  57. data/lib/nydp/helper.rb +12 -2
  58. data/lib/nydp/interpreted_function.rb +68 -40
  59. data/lib/nydp/literal.rb +1 -1
  60. data/lib/nydp/pair.rb +13 -2
  61. data/lib/nydp/parser.rb +3 -0
  62. data/lib/nydp/symbol_lookup.rb +7 -7
  63. data/lib/nydp/version.rb +1 -1
  64. data/nydp.gemspec +2 -4
  65. data/spec/date_spec.rb +79 -0
  66. data/spec/parser_spec.rb +11 -0
  67. metadata +15 -36
  68. data/lib/nydp/builtin/car.rb +0 -7
  69. data/lib/nydp/builtin/cdr.rb +0 -7
  70. data/lib/nydp/builtin/cons.rb +0 -9
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Nydp::Parser do
4
+ let(:empty) { Nydp::Symbol.mk :"", ns }
4
5
  let(:aa) { Nydp::Symbol.mk :aa, ns }
5
6
  let(:a) { Nydp::Symbol.mk :a, ns }
6
7
  let(:b) { Nydp::Symbol.mk :b, ns }
@@ -9,6 +10,7 @@ describe Nydp::Parser do
9
10
  let(:zz) { Nydp::Symbol.mk :zz, ns }
10
11
  let(:foo) { Nydp::Symbol.mk :foo, ns }
11
12
  let(:bar) { Nydp::Symbol.mk :bar, ns }
13
+ let(:foobar) { Nydp::Symbol.mk :foobar, ns }
12
14
  let(:zab) { Nydp::Symbol.mk :zab, ns }
13
15
  let(:quote) { Nydp::Symbol.mk :quote, ns }
14
16
  let(:quasiquote) { Nydp::Symbol.mk :quasiquote, ns }
@@ -19,6 +21,7 @@ describe Nydp::Parser do
19
21
  let(:dotsyn) { Nydp::Symbol.mk :"dot-syntax", ns }
20
22
  let(:cocosyn) { Nydp::Symbol.mk :"colon-colon-syntax", ns }
21
23
  let(:colosyn) { Nydp::Symbol.mk :"colon-syntax", ns }
24
+ let(:atsyn) { Nydp::Symbol.mk :"at-syntax", ns }
22
25
  let(:string_pieces) { Nydp::Symbol.mk :"string-pieces", ns }
23
26
 
24
27
  it "should return a stream of tokens" do
@@ -156,6 +159,14 @@ describe Nydp::Parser do
156
159
  expect(parse "foo::bar").to eq pair_list([cocosyn, foo, bar])
157
160
  end
158
161
 
162
+ it "should parse an at symbol" do
163
+ expect(parse "foo@bar").to eq pair_list([atsyn, foo, bar])
164
+ end
165
+
166
+ it "should parse a prefix-at symbol" do
167
+ expect(parse "@foobar").to eq pair_list([atsyn, empty, foobar])
168
+ end
169
+
159
170
  it "should parse a colon-symbol within a colon-colon within a dotted symbol" do
160
171
  expected = parse "(colon-colon-syntax (colon-syntax (dot-syntax aa foo) foo) (colon-syntax bar (dot-syntax bar zz)))"
161
172
  expect(parse "aa.foo:foo::bar:bar.zz").to eq expected
metadata CHANGED
@@ -1,59 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nydp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conan Dalton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-16 00:00:00.000000000 Z
11
+ date: 2019-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.3'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.3'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: '10.0'
19
+ version: '12'
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: '10.0'
26
+ version: '12'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.1'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.1'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec_numbering_formatter
57
29
  requirement: !ruby/object:Gem::Requirement
58
30
  requirements:
59
31
  - - ">="
@@ -95,6 +67,7 @@ files:
95
67
  - lib/lisp/core-030-syntax.nydp
96
68
  - lib/lisp/core-035-flow-control.nydp
97
69
  - lib/lisp/core-037-list-utils.nydp
70
+ - lib/lisp/core-039-module.nydp
98
71
  - lib/lisp/core-040-utils.nydp
99
72
  - lib/lisp/core-041-string-utils.nydp
100
73
  - lib/lisp/core-042-date-utils.nydp
@@ -115,11 +88,13 @@ files:
115
88
  - lib/lisp/tests/ampersand-syntax-examples.nydp
116
89
  - lib/lisp/tests/andify-examples.nydp
117
90
  - lib/lisp/tests/any-examples.nydp
91
+ - lib/lisp/tests/at-syntax-examples.nydp
118
92
  - lib/lisp/tests/auto-hash-examples.nydp
119
93
  - lib/lisp/tests/best-examples.nydp
120
94
  - lib/lisp/tests/boot-tests.nydp
121
95
  - lib/lisp/tests/builtin-tests.nydp
122
96
  - lib/lisp/tests/car-examples.nydp
97
+ - lib/lisp/tests/case-examples.nydp
123
98
  - lib/lisp/tests/cdr-set-examples.nydp
124
99
  - lib/lisp/tests/collect-tests.nydp
125
100
  - lib/lisp/tests/cons-examples.nydp
@@ -131,6 +106,7 @@ files:
131
106
  - lib/lisp/tests/detect-examples.nydp
132
107
  - lib/lisp/tests/dot-syntax-examples.nydp
133
108
  - lib/lisp/tests/dox-tests.nydp
109
+ - lib/lisp/tests/dp-examples.nydp
134
110
  - lib/lisp/tests/dynamic-scope-test.nydp
135
111
  - lib/lisp/tests/each-tests.nydp
136
112
  - lib/lisp/tests/empty-examples.nydp
@@ -148,12 +124,14 @@ files:
148
124
  - lib/lisp/tests/isa-examples.nydp
149
125
  - lib/lisp/tests/k-examples.nydp
150
126
  - lib/lisp/tests/len-examples.nydp
127
+ - lib/lisp/tests/list-grep-examples.nydp
151
128
  - lib/lisp/tests/list-gsub-examples.nydp
152
129
  - lib/lisp/tests/list-match-examples.nydp
153
130
  - lib/lisp/tests/list-tests.nydp
154
131
  - lib/lisp/tests/map-hash-examples.nydp
155
132
  - lib/lisp/tests/mapreduce-examples.nydp
156
133
  - lib/lisp/tests/mapsum-examples.nydp
134
+ - lib/lisp/tests/module-examples.nydp
157
135
  - lib/lisp/tests/none-examples.nydp
158
136
  - lib/lisp/tests/orequal-examples.nydp
159
137
  - lib/lisp/tests/parser-tests.nydp
@@ -184,12 +162,10 @@ files:
184
162
  - lib/nydp.rb
185
163
  - lib/nydp/assignment.rb
186
164
  - lib/nydp/builtin.rb
165
+ - lib/nydp/builtin/abs.rb
187
166
  - lib/nydp/builtin/apply.rb
188
- - lib/nydp/builtin/car.rb
189
- - lib/nydp/builtin/cdr.rb
190
167
  - lib/nydp/builtin/cdr_set.rb
191
168
  - lib/nydp/builtin/comment.rb
192
- - lib/nydp/builtin/cons.rb
193
169
  - lib/nydp/builtin/date.rb
194
170
  - lib/nydp/builtin/divide.rb
195
171
  - lib/nydp/builtin/ensuring.rb
@@ -215,12 +191,15 @@ files:
215
191
  - lib/nydp/builtin/quit.rb
216
192
  - lib/nydp/builtin/rand.rb
217
193
  - lib/nydp/builtin/random_string.rb
194
+ - lib/nydp/builtin/ruby_wrap.rb
218
195
  - lib/nydp/builtin/script_run.rb
219
196
  - lib/nydp/builtin/set_intersection.rb
220
197
  - lib/nydp/builtin/set_union.rb
221
198
  - lib/nydp/builtin/sort.rb
222
199
  - lib/nydp/builtin/sqrt.rb
223
200
  - lib/nydp/builtin/string_match.rb
201
+ - lib/nydp/builtin/string_pad_left.rb
202
+ - lib/nydp/builtin/string_pad_right.rb
224
203
  - lib/nydp/builtin/string_replace.rb
225
204
  - lib/nydp/builtin/string_split.rb
226
205
  - lib/nydp/builtin/sym.rb
@@ -299,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
299
278
  version: '0'
300
279
  requirements: []
301
280
  rubyforge_project:
302
- rubygems_version: 2.2.2
281
+ rubygems_version: 2.5.2.3
303
282
  signing_key:
304
283
  specification_version: 4
305
284
  summary: A civilised yet somewhat dangerous kind of Lisp for a new generation
@@ -1,7 +0,0 @@
1
- class Nydp::Builtin::Car
2
- include Nydp::Builtin::Base, Singleton
3
-
4
- def builtin_invoke vm, args
5
- vm.push_arg args.car.car
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- class Nydp::Builtin::Cdr
2
- include Nydp::Builtin::Base, Singleton
3
-
4
- def builtin_invoke vm, args
5
- vm.push_arg args.car.cdr
6
- end
7
- end
@@ -1,9 +0,0 @@
1
- module Nydp::Builtin
2
- class Cons
3
- include Nydp::Builtin::Base, Singleton
4
-
5
- def builtin_invoke vm, args
6
- vm.push_arg Nydp::Pair.new(args.car, args.cdr.car)
7
- end
8
- end
9
- end