nendo 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Rakefile +20 -18
- data/VERSION.yml +1 -1
- data/lib/nendo/init.nndc +269 -269
- data/lib/nendo/nendo/experimental.nnd +69 -1
- data/lib/nendo/nendo/experimental.nndc +1814 -933
- data/lib/nendo/nendo/test.nndc +16 -16
- data/lib/nendo/rfc/json.nndc +6 -6
- data/lib/nendo/ruby/builtin_functions.rb +2 -0
- data/lib/nendo/ruby/core.rb +1 -1
- data/lib/nendo/ruby/printer.rb +2 -0
- data/lib/nendo/srfi-1.nnd +20 -5
- data/lib/nendo/srfi-1.nndc +1814 -1706
- data/lib/nendo/srfi-2.nndc +154 -154
- data/lib/nendo/srfi-26.nndc +433 -433
- data/lib/nendo/text/html-lite.nndc +46 -46
- data/lib/nendo/util/combinations.nndc +213 -213
- data/lib/nendo/util/list.nndc +294 -294
- data/lib/nendo/util/match.nnd +1 -1
- data/lib/nendo/util/match.nndc +5724 -5724
- data/test/nendo-util-test.nnd +121 -0
- data/test/nendo_spec.rb +5 -0
- data/test/rspec_formatter_for_emacs.rb +1 -0
- metadata +66 -17
data/test/nendo-util-test.nnd
CHANGED
@@ -370,6 +370,127 @@ trampCall(
|
|
370
370
|
(v.yield "three")))))
|
371
371
|
|
372
372
|
|
373
|
+
(test* "fold (for vector)"
|
374
|
+
120
|
375
|
+
(fold
|
376
|
+
(lambda (item result) (* item result))
|
377
|
+
1
|
378
|
+
'#(1 2 3 4 5)))
|
379
|
+
|
380
|
+
(test* "fold (for Range)"
|
381
|
+
5050
|
382
|
+
(fold
|
383
|
+
(lambda (item result) (+ item result))
|
384
|
+
1
|
385
|
+
(Range.new 2 100)))
|
386
|
+
|
387
|
+
(test* "fold (for string vector)"
|
388
|
+
"a/b/c/d/e/f/g/h"
|
389
|
+
(fold
|
390
|
+
(lambda (item result) (+ result "/" item))
|
391
|
+
"a"
|
392
|
+
(. "bcdefgh" split "")))
|
393
|
+
|
394
|
+
(test* "fold (for Enumerable)"
|
395
|
+
"one:two:three:four"
|
396
|
+
(fold
|
397
|
+
(lambda (item result) (+ result ":" item))
|
398
|
+
"one"
|
399
|
+
(Enumerator.new
|
400
|
+
(&block (v)
|
401
|
+
(v.yield "two")
|
402
|
+
(v.yield "three")
|
403
|
+
(v.yield "four")
|
404
|
+
))))
|
405
|
+
|
373
406
|
|
407
|
+
;;-------------------------------------------------------------------
|
408
|
+
(test-section "ruby-lazy for Enumerable")
|
409
|
+
|
410
|
+
(let1 arr '#(1 2 3)
|
411
|
+
(test* "ruby-lazy is a kind of vector? (1)"
|
412
|
+
#t
|
413
|
+
(vector? arr))
|
414
|
+
(test* "ruby-lazy is a kind of vector? (2)"
|
415
|
+
#t
|
416
|
+
(vector? (ruby-lazy arr)))
|
417
|
+
(test* "ruby-lazy is a kind of vector? (3)"
|
418
|
+
#t
|
419
|
+
(vector? (ruby-lazy (ruby-lazy arr)))))
|
420
|
+
|
421
|
+
(if (ruby-lazy-enabled-platform?)
|
422
|
+
;; Ruby 2.0
|
423
|
+
(let ((arr '#(1 2 3))
|
424
|
+
(vec (ruby-lazy '#( 1 2 3 4 5 6 7 8 9 10 ))))
|
425
|
+
|
426
|
+
(test* "ruby-lazy? (for Ruby-2.0)"
|
427
|
+
#f
|
428
|
+
(ruby-lazy? arr))
|
429
|
+
(test* "ruby-lazy? (for Ruby-2.0)"
|
430
|
+
#t
|
431
|
+
(ruby-lazy? (ruby-lazy arr)))
|
432
|
+
(test* "ruby-lazy? (for Ruby-2.0)"
|
433
|
+
#t
|
434
|
+
(ruby-lazy? (ruby-lazy (ruby-lazy arr))))
|
435
|
+
(test* "ruby-lazy? (for Ruby-2.0)"
|
436
|
+
#f
|
437
|
+
(ruby-lazy? STDIN))
|
438
|
+
(test* "ruby-lazy? (for Ruby-2.0)"
|
439
|
+
#t
|
440
|
+
(ruby-lazy? (ruby-lazy STDIN)))
|
441
|
+
(test* "size of ruby-lazy (for Ruby-2.0)"
|
442
|
+
10
|
443
|
+
(vec.size))
|
444
|
+
(test* "size of ruby-lazy (for Ruby-2.0)"
|
445
|
+
10
|
446
|
+
(vector-length vec))
|
447
|
+
(test* "index of ruby-lazy"
|
448
|
+
(test-error NoMethodError)
|
449
|
+
(vector-ref vec 2))
|
450
|
+
(test* "ruby-lazy to list"
|
451
|
+
'(1 2 3 4 5 6 7 8 9 10)
|
452
|
+
(vector->list vec))
|
453
|
+
(test* "size of ruby-lazy"
|
454
|
+
10
|
455
|
+
(length (vector->list vec)))
|
456
|
+
(test* "index of ruby-lazy"
|
457
|
+
3
|
458
|
+
(vector-ref (list->vector (vector->list vec)) 2))
|
459
|
+
(test* "vector-equal?"
|
460
|
+
(test-error NoMethodError)
|
461
|
+
(vector-equal? vec (list->vector (range 10 1))))
|
462
|
+
(test* "vector-equal?"
|
463
|
+
#t
|
464
|
+
(vector-equal? (list->vector (vector->list vec)) (list->vector (range 10 1))))
|
465
|
+
(test* "vector-length"
|
466
|
+
(test-error TypeError)
|
467
|
+
(length (ruby-lazy (make-vector 100))))
|
468
|
+
(test* "vector-length"
|
469
|
+
100
|
470
|
+
(length (vector->list (ruby-lazy (make-vector 100)))))
|
471
|
+
)
|
472
|
+
|
473
|
+
;; Ruby 1.9.x
|
474
|
+
(let1 arr '#(1 2 3)
|
475
|
+
(test* "ruby-lazy? (for Ruby 1.9.x)"
|
476
|
+
#f
|
477
|
+
(ruby-lazy? arr))
|
478
|
+
(test* "ruby-lazy? (for Ruby 1.9.x)"
|
479
|
+
#f
|
480
|
+
(ruby-lazy? (ruby-lazy arr)))
|
481
|
+
(test* "ruby-lazy? (for Ruby 1.9.x)"
|
482
|
+
#f
|
483
|
+
(ruby-lazy? (ruby-lazy (ruby-lazy arr))))
|
484
|
+
(test* "ruby-lazy? (for Ruby 1.9.x)"
|
485
|
+
#f
|
486
|
+
(ruby-lazy? STDIN))
|
487
|
+
(test* "ruby-lazy? (for Ruby 1.9.x)"
|
488
|
+
#f
|
489
|
+
(ruby-lazy? (ruby-lazy STDIN)))
|
490
|
+
))
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
374
495
|
;;===================================================================
|
375
496
|
(test-end)
|
data/test/nendo_spec.rb
CHANGED
@@ -1776,6 +1776,11 @@ EOS
|
|
1776
1776
|
@nendo.evalStr( " (filter-map (lambda (x) (= x 100)) '(1 2 3)) " ).should == "()"
|
1777
1777
|
@nendo.evalStr( " (filter-map (lambda (x) (= x 2)) '(1 2 3)) " ).should == "(#t)"
|
1778
1778
|
@nendo.evalStr( " (filter-map (lambda (x) (not (= x 2))) '(1 2 3)) " ).should == "(#t #t)"
|
1779
|
+
@nendo.evalStr( " (fold (lambda (x y) x y) 0 '()) " ).should == "0"
|
1780
|
+
@nendo.evalStr( " (fold (lambda (x y) (+ x y)) 0 '(1 2 3)) " ).should == "6"
|
1781
|
+
@nendo.evalStr( " (fold (lambda (x y) (+ x y)) 1 '(2 3 4)) " ).should == "10"
|
1782
|
+
@nendo.evalStr( " (fold (lambda (x y) (* x y)) 1 '(2 3 4 5)) " ).should == "120"
|
1783
|
+
@nendo.evalStr( " (fold (lambda (x y) (* x y)) 0 '(2 3 4 5)) " ).should == "0"
|
1779
1784
|
@nendo.evalStr( <<EOS
|
1780
1785
|
(filter-map
|
1781
1786
|
(lambda (x)
|
@@ -4,6 +4,7 @@ require 'rspec/core/formatters/progress_formatter'
|
|
4
4
|
# ruby bin/spec xxxxx.rb -r ./test/rspec_formatter_for_emacs.rb -f CustomFormatter
|
5
5
|
class CustomFormatter < RSpec::Core::Formatters::ProgressFormatter
|
6
6
|
def backtrace_line(line)
|
7
|
+
return nil if configuration.cleaned_from_backtrace?(line)
|
7
8
|
str = line.gsub(/([^:]*\.rb):([0-9]+):in /) do
|
8
9
|
path = "#{$1}"
|
9
10
|
lineno = "#{$2}"
|
metadata
CHANGED
@@ -1,49 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nendo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
5
|
-
prerelease:
|
4
|
+
version: 0.6.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Kiyoka Nishiyama
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-03-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
|
-
type: :
|
20
|
+
type: :development
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
25
41
|
- !ruby/object:Gem::Dependency
|
26
42
|
name: json
|
27
|
-
requirement:
|
28
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
29
44
|
requirements:
|
30
45
|
- - ! '>='
|
31
46
|
- !ruby/object:Gem::Version
|
32
47
|
version: '0'
|
33
48
|
type: :runtime
|
34
49
|
prerelease: false
|
35
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
36
69
|
- !ruby/object:Gem::Dependency
|
37
70
|
name: rake
|
38
|
-
requirement:
|
39
|
-
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: json
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
40
86
|
requirements:
|
41
87
|
- - ! '>='
|
42
88
|
- !ruby/object:Gem::Version
|
43
89
|
version: '0'
|
44
90
|
type: :runtime
|
45
91
|
prerelease: false
|
46
|
-
version_requirements:
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
47
97
|
description: Nendo is a programming language written in Ruby.
|
48
98
|
email: kiyoka@sumibi.org
|
49
99
|
executables:
|
@@ -131,26 +181,25 @@ files:
|
|
131
181
|
- test/util-list-test.nnd
|
132
182
|
homepage: http://github.com/kiyoka/nendo
|
133
183
|
licenses: []
|
184
|
+
metadata: {}
|
134
185
|
post_install_message:
|
135
186
|
rdoc_options: []
|
136
187
|
require_paths:
|
137
188
|
- lib
|
138
189
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
190
|
requirements:
|
141
191
|
- - ! '>='
|
142
192
|
- !ruby/object:Gem::Version
|
143
193
|
version: '0'
|
144
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
195
|
requirements:
|
147
196
|
- - ! '>='
|
148
197
|
- !ruby/object:Gem::Version
|
149
198
|
version: '0'
|
150
199
|
requirements: []
|
151
200
|
rubyforge_project:
|
152
|
-
rubygems_version:
|
201
|
+
rubygems_version: 2.0.3
|
153
202
|
signing_key:
|
154
|
-
specification_version:
|
203
|
+
specification_version: 4
|
155
204
|
summary: Nendo is a dialect of Lisp.
|
156
205
|
test_files: []
|