nendo 0.3.3 → 0.3.4
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.
- data/bin/nendo +2 -2
- data/emacs/nendo-mode.el +126 -0
- data/example/KyotoCabinet/kcbench.rb +20 -0
- data/example/KyotoCabinet/kcbench1.nnd +29 -0
- data/example/KyotoCabinet/kcbench2.nnd +30 -0
- data/example/KyotoCabinet/kcbench3.nnd +31 -0
- data/example/export-lisp-functions.rb +20 -0
- data/example/scratch.nnd +8 -17
- data/example/tak_ruby_version.rb +14 -0
- data/lib/debug/syslog.nndc +1 -1
- data/lib/init.nnd +334 -202
- data/lib/init.nndc +5691 -4128
- data/lib/nendo/test.nnd +165 -0
- data/lib/nendo/test.nndc +1635 -0
- data/lib/nendo.rb +248 -37
- data/lib/srfi-1.nnd +15 -24
- data/lib/srfi-1.nndc +1247 -1607
- data/lib/text/html-lite.nnd +1 -1
- data/lib/text/html-lite.nndc +171 -171
- data/lib/text/tree.nndc +2 -2
- data/test/nendo_spec.rb +1281 -981
- data/test/nendo_util.nnd +98 -0
- data/test/srfi-1-test.nnd +28 -0
- data/test/textlib.nnd +24 -0
- metadata +13 -3
    
        data/test/nendo_spec.rb
    CHANGED
    
    | @@ -136,6 +136,18 @@ describe Nendo, "Ruby's lexical closure " do | |
| 136 136 | 
             
              end
         | 
| 137 137 | 
             
            end
         | 
| 138 138 |  | 
| 139 | 
            +
            describe Nendo, "Japanese characters in regex " do
         | 
| 140 | 
            +
              before do
         | 
| 141 | 
            +
                @matchData = "ABC漢字あいうえお漢字ABC".match( /([あ-ん])([あ-ん])([あ-ん])([あ-ん])([あ-ん])/ )
         | 
| 142 | 
            +
              end
         | 
| 143 | 
            +
              it "should" do
         | 
| 144 | 
            +
                @matchData.should be_true
         | 
| 145 | 
            +
                pending( "JRuby can't compute correctly" ) if defined? JRUBY_VERSION
         | 
| 146 | 
            +
                @matchData[0].should == "あいうえお"
         | 
| 147 | 
            +
                @matchData[1].should == "あ"
         | 
| 148 | 
            +
              end
         | 
| 149 | 
            +
            end
         | 
| 150 | 
            +
             | 
| 139 151 |  | 
| 140 152 | 
             
            describe Nendo, "Ruby's undefined instance variable " do
         | 
| 141 153 | 
             
              it "should" do
         | 
| @@ -146,7 +158,7 @@ end | |
| 146 158 |  | 
| 147 159 | 
             
            describe Evaluator, "When use Evaluator's util methods" do
         | 
| 148 160 | 
             
              before do
         | 
| 149 | 
            -
                @evaluator = Evaluator.new()
         | 
| 161 | 
            +
                @evaluator = Evaluator.new(Nendo::Core.new())
         | 
| 150 162 | 
             
              end
         | 
| 151 163 | 
             
              it "should" do
         | 
| 152 164 | 
             
                @evaluator.toRubySymbol( "a" ).should == "_a"
         | 
| @@ -201,290 +213,290 @@ describe Evaluator, "When use Evaluator's util methods" do | |
| 201 213 | 
             
              end
         | 
| 202 214 | 
             
            end
         | 
| 203 215 |  | 
| 204 | 
            -
            describe Nendo, "when call  | 
| 216 | 
            +
            describe Nendo, "when call evalStr() with literals" do
         | 
| 205 217 | 
             
              before do
         | 
| 206 218 | 
             
                @nendo = Nendo::Core.new()
         | 
| 207 219 | 
             
              end
         | 
| 208 220 | 
             
              it "should" do
         | 
| 209 | 
            -
                @nendo. | 
| 210 | 
            -
                @nendo. | 
| 211 | 
            -
                @nendo. | 
| 212 | 
            -
                @nendo. | 
| 213 | 
            -
                @nendo. | 
| 214 | 
            -
                @nendo. | 
| 215 | 
            -
                @nendo. | 
| 216 | 
            -
                @nendo. | 
| 217 | 
            -
                @nendo. | 
| 218 | 
            -
                @nendo. | 
| 219 | 
            -
                @nendo. | 
| 220 | 
            -
                @nendo. | 
| 221 | 
            -
                @nendo. | 
| 222 | 
            -
                @nendo. | 
| 223 | 
            -
                @nendo. | 
| 224 | 
            -
                @nendo. | 
| 225 | 
            -
                @nendo. | 
| 221 | 
            +
                @nendo.evalStr( " 1 " ).should == "1"
         | 
| 222 | 
            +
                @nendo.evalStr( " 100000 " ).should == "100000"
         | 
| 223 | 
            +
                @nendo.evalStr( " 1.1 " ).should == "1.1"
         | 
| 224 | 
            +
                @nendo.evalStr( " 1.0 " ).should == "1.0"
         | 
| 225 | 
            +
                @nendo.evalStr( ' "a" ' ).should == '"a"'
         | 
| 226 | 
            +
                @nendo.evalStr( ' "日本語" ' ).should == '"日本語"'
         | 
| 227 | 
            +
                @nendo.evalStr( ' "\n" ' ).should == "\"\n\""
         | 
| 228 | 
            +
                @nendo.evalStr( ' "\r" ' ).should == "\"\\r\""
         | 
| 229 | 
            +
                @nendo.evalStr( ' "\t" ' ).should == "\"\\t\""
         | 
| 230 | 
            +
                @nendo.evalStr( ' "a" ' ).should == '"a"'
         | 
| 231 | 
            +
                @nendo.evalStr( ' "a\"b" ' ).should == '"a\"b"'
         | 
| 232 | 
            +
                @nendo.evalStr( ' "日\"本\"語" ' ).should == '"日\"本\"語"'
         | 
| 233 | 
            +
                @nendo.evalStr( " true " ).should == "#t"
         | 
| 234 | 
            +
                @nendo.evalStr( " false " ).should == "#f"
         | 
| 235 | 
            +
                @nendo.evalStr( " nil " ).should == "nil"
         | 
| 236 | 
            +
                @nendo.evalStr( " #t " ).should == "#t"
         | 
| 237 | 
            +
                @nendo.evalStr( " #f " ).should == "#f"
         | 
| 226 238 |  | 
| 227 239 | 
             
              end
         | 
| 228 240 | 
             
            end
         | 
| 229 241 |  | 
| 230 | 
            -
            describe Nendo, "when call  | 
| 242 | 
            +
            describe Nendo, "when call evalStr() with comparative operators" do
         | 
| 231 243 | 
             
              before do
         | 
| 232 244 | 
             
                @nendo = Nendo::Core.new()
         | 
| 233 245 | 
             
              end
         | 
| 234 246 | 
             
              it "should" do
         | 
| 235 | 
            -
                @nendo. | 
| 236 | 
            -
                @nendo. | 
| 237 | 
            -
                @nendo. | 
| 238 | 
            -
                @nendo. | 
| 239 | 
            -
                @nendo. | 
| 240 | 
            -
                @nendo. | 
| 241 | 
            -
                @nendo. | 
| 242 | 
            -
                @nendo. | 
| 243 | 
            -
                @nendo. | 
| 244 | 
            -
                @nendo. | 
| 245 | 
            -
                @nendo. | 
| 246 | 
            -
                @nendo. | 
| 247 | 
            -
                @nendo. | 
| 248 | 
            -
                @nendo. | 
| 249 | 
            -
                @nendo. | 
| 250 | 
            -
                @nendo. | 
| 251 | 
            -
                @nendo. | 
| 252 | 
            -
                @nendo. | 
| 253 | 
            -
                @nendo. | 
| 254 | 
            -
                @nendo. | 
| 255 | 
            -
                @nendo. | 
| 256 | 
            -
                @nendo. | 
| 257 | 
            -
                @nendo. | 
| 258 | 
            -
                @nendo. | 
| 259 | 
            -
                @nendo. | 
| 260 | 
            -
                @nendo. | 
| 261 | 
            -
                @nendo. | 
| 262 | 
            -
                @nendo. | 
| 263 | 
            -
                @nendo. | 
| 264 | 
            -
                @nendo. | 
| 265 | 
            -
                @nendo. | 
| 266 | 
            -
                @nendo. | 
| 267 | 
            -
                @nendo. | 
| 268 | 
            -
                @nendo. | 
| 269 | 
            -
                @nendo. | 
| 270 | 
            -
                @nendo. | 
| 271 | 
            -
                @nendo. | 
| 272 | 
            -
                @nendo. | 
| 273 | 
            -
                @nendo. | 
| 274 | 
            -
                @nendo. | 
| 275 | 
            -
                @nendo. | 
| 276 | 
            -
                @nendo. | 
| 277 | 
            -
                @nendo. | 
| 247 | 
            +
                @nendo.evalStr( " (= 1 1) " ).should == "#t"
         | 
| 248 | 
            +
                @nendo.evalStr( " (= 1 2) " ).should == "#f"
         | 
| 249 | 
            +
                @nendo.evalStr( " (= #t #t) " ).should == "#t"
         | 
| 250 | 
            +
                @nendo.evalStr( " (= #f #f) " ).should == "#t"
         | 
| 251 | 
            +
                @nendo.evalStr( " (= true true) " ).should == "#t"
         | 
| 252 | 
            +
                @nendo.evalStr( " (= false false) " ).should == "#t"
         | 
| 253 | 
            +
                @nendo.evalStr( " (= #t true) " ).should == "#t"
         | 
| 254 | 
            +
                @nendo.evalStr( " (= #f false) " ).should == "#t"
         | 
| 255 | 
            +
                @nendo.evalStr( " (= #t #f) " ).should == "#f"
         | 
| 256 | 
            +
                @nendo.evalStr( " (= true false) " ).should == "#f"
         | 
| 257 | 
            +
                @nendo.evalStr( " (eq? 1 1) " ).should == "#t"
         | 
| 258 | 
            +
                @nendo.evalStr( " (eq? 1 2) " ).should == "#f"
         | 
| 259 | 
            +
                @nendo.evalStr( " (eq? 'a 'a) " ).should == "#t"
         | 
| 260 | 
            +
                @nendo.evalStr( " (eq? 'b 'b) " ).should == "#t"
         | 
| 261 | 
            +
                @nendo.evalStr( " (eq? 'a-b 'a-b) " ).should == "#t"
         | 
| 262 | 
            +
                @nendo.evalStr( " (eq? 'a_b 'a-b) " ).should == "#f"
         | 
| 263 | 
            +
                @nendo.evalStr( " (eq? 'a-b 'a_b) " ).should == "#f"
         | 
| 264 | 
            +
                @nendo.evalStr( " (< 1 1) " ).should == "#f"
         | 
| 265 | 
            +
                @nendo.evalStr( " (< 1 2) " ).should == "#t"
         | 
| 266 | 
            +
                @nendo.evalStr( " (> 1 1) " ).should == "#f"
         | 
| 267 | 
            +
                @nendo.evalStr( " (> 2 1) " ).should == "#t"
         | 
| 268 | 
            +
                @nendo.evalStr( " (<= 1 0) " ).should == "#f"
         | 
| 269 | 
            +
                @nendo.evalStr( " (<= 1 1) " ).should == "#t"
         | 
| 270 | 
            +
                @nendo.evalStr( " (<= 1 2) " ).should == "#t"
         | 
| 271 | 
            +
                @nendo.evalStr( " (>= 0 1) " ).should == "#f"
         | 
| 272 | 
            +
                @nendo.evalStr( " (>= 1 1) " ).should == "#t"
         | 
| 273 | 
            +
                @nendo.evalStr( " (equal? 1 1) " ).should == "#t"
         | 
| 274 | 
            +
                @nendo.evalStr( " (equal? 1 2) " ).should == "#f"
         | 
| 275 | 
            +
                @nendo.evalStr( " (equal? 2 2) " ).should == "#t"
         | 
| 276 | 
            +
                @nendo.evalStr( " (equal? '() '()) " ).should == "#t"
         | 
| 277 | 
            +
                @nendo.evalStr( " (equal? '(1) '(1)) " ).should == "#t"
         | 
| 278 | 
            +
                @nendo.evalStr( " (equal? '(1) '(2)) " ).should == "#f"
         | 
| 279 | 
            +
                @nendo.evalStr( " (equal? '(1 2 3) '(1 2 3)) " ).should == "#t"
         | 
| 280 | 
            +
                @nendo.evalStr( " (equal? '(1 2 . 3) '(1 2 . 3)) " ).should == "#t"
         | 
| 281 | 
            +
                @nendo.evalStr( " (equal? '(1 2 (3)) '(1 2 (3))) " ).should == "#t"
         | 
| 282 | 
            +
                @nendo.evalStr( " (equal? '(1 2 (3)) '(1 2 (4))) " ).should == "#f"
         | 
| 283 | 
            +
                @nendo.evalStr( " (equal? '(1 2 (3 (4))) '(1 2 (3 (4)))) " ).should == "#t"
         | 
| 284 | 
            +
                @nendo.evalStr( " (equal? '((1) 2 3 4) '((2) 2 3 4)) " ).should == "#f"
         | 
| 285 | 
            +
                @nendo.evalStr( " (equal? \"aaa\" \"aaa\") " ).should == "#t"
         | 
| 286 | 
            +
                @nendo.evalStr( " (equal? \"aaa\" \"aax\") " ).should == "#f"
         | 
| 287 | 
            +
                @nendo.evalStr( " (equal? '(\"aaa\") '(\"aaa\")) " ).should == "#t"
         | 
| 288 | 
            +
                @nendo.evalStr( " (equal? '(\"aaa\" (1)) '(\"aaa\" (1))) " ).should == "#t"
         | 
| 289 | 
            +
                @nendo.evalStr( " (equal? '(\"aaa\" (1)) '(\"aaa\" (2))) " ).should == "#f"
         | 
| 278 290 | 
             
              end
         | 
| 279 291 | 
             
            end
         | 
| 280 292 |  | 
| 281 | 
            -
            describe Nendo, "when call  | 
| 293 | 
            +
            describe Nendo, "when call evalStr() with boolean operators" do
         | 
| 282 294 | 
             
              before do
         | 
| 283 295 | 
             
                @nendo = Nendo::Core.new()
         | 
| 284 296 | 
             
              end
         | 
| 285 297 | 
             
              it "should" do
         | 
| 286 | 
            -
                @nendo. | 
| 287 | 
            -
                @nendo. | 
| 288 | 
            -
                @nendo. | 
| 289 | 
            -
                @nendo. | 
| 290 | 
            -
                @nendo. | 
| 291 | 
            -
                @nendo. | 
| 292 | 
            -
                @nendo. | 
| 293 | 
            -
                @nendo. | 
| 294 | 
            -
                @nendo. | 
| 295 | 
            -
                @nendo. | 
| 296 | 
            -
                @nendo. | 
| 297 | 
            -
                @nendo. | 
| 298 | 
            -
                @nendo. | 
| 299 | 
            -
                @nendo. | 
| 300 | 
            -
                @nendo. | 
| 298 | 
            +
                @nendo.evalStr( " true " ).should == "#t"
         | 
| 299 | 
            +
                @nendo.evalStr( " false " ).should == "#f"
         | 
| 300 | 
            +
                @nendo.evalStr( " #t " ).should == "#t"
         | 
| 301 | 
            +
                @nendo.evalStr( " #f " ).should == "#f"
         | 
| 302 | 
            +
                @nendo.evalStr( " (not true) " ).should == "#f"
         | 
| 303 | 
            +
                @nendo.evalStr( " (not #t) " ).should == "#f"
         | 
| 304 | 
            +
                @nendo.evalStr( " (not 1) " ).should == "#f"
         | 
| 305 | 
            +
                @nendo.evalStr( " (not false) " ).should == "#t"
         | 
| 306 | 
            +
                @nendo.evalStr( " (not #f) " ).should == "#t"
         | 
| 307 | 
            +
                @nendo.evalStr( " (not \"str\") " ).should == "#f"
         | 
| 308 | 
            +
                @nendo.evalStr( " (not not) " ).should == "#f"
         | 
| 309 | 
            +
                @nendo.evalStr( " (not (not true)) " ).should == "#t"
         | 
| 310 | 
            +
                @nendo.evalStr( " (not (not #t)) " ).should == "#t"
         | 
| 311 | 
            +
                @nendo.evalStr( " (not '()) " ).should == "#f"
         | 
| 312 | 
            +
                @nendo.evalStr( " (not '(1)) " ).should == "#f"
         | 
| 301 313 | 
             
              end
         | 
| 302 314 | 
             
            end
         | 
| 303 315 |  | 
| 304 | 
            -
            describe Nendo, "when call  | 
| 316 | 
            +
            describe Nendo, "when call evalStr() with `+' function" do
         | 
| 305 317 | 
             
              before do
         | 
| 306 318 | 
             
                @nendo = Nendo::Core.new()
         | 
| 307 319 | 
             
              end
         | 
| 308 320 | 
             
              it "should" do
         | 
| 309 | 
            -
                @nendo. | 
| 310 | 
            -
                @nendo. | 
| 311 | 
            -
                @nendo. | 
| 312 | 
            -
                @nendo. | 
| 313 | 
            -
                @nendo. | 
| 314 | 
            -
                @nendo. | 
| 315 | 
            -
                @nendo. | 
| 316 | 
            -
                @nendo. | 
| 317 | 
            -
                @nendo. | 
| 318 | 
            -
                @nendo. | 
| 319 | 
            -
                lambda { @nendo. | 
| 320 | 
            -
                lambda { @nendo. | 
| 321 | 
            -
                lambda { @nendo. | 
| 322 | 
            -
                lambda { @nendo. | 
| 323 | 
            -
                lambda { @nendo. | 
| 324 | 
            -
                lambda { @nendo. | 
| 325 | 
            -
                lambda { @nendo. | 
| 321 | 
            +
                @nendo.evalStr( " (+ 1) " ).should == "1"
         | 
| 322 | 
            +
                @nendo.evalStr( " (+ 1 1) " ).should == "2"
         | 
| 323 | 
            +
                @nendo.evalStr( " (+ 1 1 1 1 1 1 1 1 1 1) " ).should == "10"
         | 
| 324 | 
            +
                @nendo.evalStr( " (+ 1 2 3 4 5) " ).should == "15"
         | 
| 325 | 
            +
                @nendo.evalStr( " (+ 1 (+ 2 (+ 3 (+ 4 (+ 5))))) " ).should == "15"
         | 
| 326 | 
            +
                @nendo.evalStr( " (+ 1   1.1) " ).should == "2.1"
         | 
| 327 | 
            +
                @nendo.evalStr( " (+ 1.1 1.2) " ).should == "2.3"
         | 
| 328 | 
            +
                @nendo.evalStr( " (+ \"a\" ) " ).should == '"a"'
         | 
| 329 | 
            +
                @nendo.evalStr( " (+ \"a\" \"B\" \"c\" ) " ).should == '"aBc"'
         | 
| 330 | 
            +
                @nendo.evalStr( " (+) " ).should == "0"
         | 
| 331 | 
            +
                lambda { @nendo.evalStr( " (+ '() ) " ) }.should         raise_error(TypeError)
         | 
| 332 | 
            +
                lambda { @nendo.evalStr( " (+ 1 '() ) " ) }.should       raise_error(TypeError)
         | 
| 333 | 
            +
                lambda { @nendo.evalStr( " (+ 1.1 '() ) " ) }.should     raise_error(TypeError)
         | 
| 334 | 
            +
                lambda { @nendo.evalStr( " (+ '(1) ) " ) }.should        raise_error(TypeError)
         | 
| 335 | 
            +
                lambda { @nendo.evalStr( " (+ 1.1 \"a\" ) " ) }.should   raise_error(TypeError)
         | 
| 336 | 
            +
                lambda { @nendo.evalStr( " (+ \"a\" 1) " ) }.should      raise_error(TypeError)
         | 
| 337 | 
            +
                lambda { @nendo.evalStr( " (+ \"a\" 1.1) " ) }.should    raise_error(TypeError)
         | 
| 326 338 | 
             
              end
         | 
| 327 339 | 
             
            end
         | 
| 328 340 |  | 
| 329 | 
            -
            describe Nendo, "when call  | 
| 341 | 
            +
            describe Nendo, "when call evalStr() with `-' function" do
         | 
| 330 342 | 
             
              before do
         | 
| 331 343 | 
             
                @nendo = Nendo::Core.new()
         | 
| 332 344 | 
             
              end
         | 
| 333 345 | 
             
              it "should" do
         | 
| 334 | 
            -
                @nendo. | 
| 335 | 
            -
                @nendo. | 
| 336 | 
            -
                @nendo. | 
| 337 | 
            -
                @nendo. | 
| 338 | 
            -
                @nendo. | 
| 339 | 
            -
                @nendo. | 
| 340 | 
            -
                @nendo. | 
| 341 | 
            -
                lambda { @nendo. | 
| 342 | 
            -
                lambda { @nendo. | 
| 343 | 
            -
                lambda { @nendo. | 
| 344 | 
            -
                lambda { @nendo. | 
| 345 | 
            -
                lambda { @nendo. | 
| 346 | 
            -
                lambda { @nendo. | 
| 346 | 
            +
                @nendo.evalStr( " (- 1) " ).should == "-1"
         | 
| 347 | 
            +
                @nendo.evalStr( " (- 2 1) " ).should == "1"
         | 
| 348 | 
            +
                @nendo.evalStr( " (- 2 5) " ).should == "-3"
         | 
| 349 | 
            +
                @nendo.evalStr( " (- 100 1 1 1 1 1 1 1 1 1 1) " ).should == "90"
         | 
| 350 | 
            +
                @nendo.evalStr( " (- 100 (- 10 3)) " ).should == "93"
         | 
| 351 | 
            +
                @nendo.evalStr( " (- 1.1 1) " ).should == (1.1-1).to_s
         | 
| 352 | 
            +
                @nendo.evalStr( " (- 1.3 1.1) " ).should == (1.3-1.1).to_s
         | 
| 353 | 
            +
                lambda { @nendo.evalStr( " (- 1 '() ) " ) }.should       raise_error(TypeError)
         | 
| 354 | 
            +
                lambda { @nendo.evalStr( " (- 1.1 '() ) " ) }.should     raise_error(TypeError)
         | 
| 355 | 
            +
                lambda { @nendo.evalStr( " (-) " ) }.should              raise_error(ArgumentError)
         | 
| 356 | 
            +
                lambda { @nendo.evalStr( " (- '(1) ) " ) }.should        raise_error(TypeError)
         | 
| 357 | 
            +
                lambda { @nendo.evalStr( " (- '() ) " ) }.should         raise_error(TypeError)
         | 
| 358 | 
            +
                lambda { @nendo.evalStr( " (- 1.1 \"a\" ) " ) }.should   raise_error(TypeError)
         | 
| 347 359 | 
             
              end
         | 
| 348 360 | 
             
            end
         | 
| 349 361 |  | 
| 350 | 
            -
            describe Nendo, "when call  | 
| 362 | 
            +
            describe Nendo, "when call evalStr() with `*' function" do
         | 
| 351 363 | 
             
              before do
         | 
| 352 364 | 
             
                @nendo = Nendo::Core.new()
         | 
| 353 365 | 
             
              end
         | 
| 354 366 | 
             
              it "should" do
         | 
| 355 | 
            -
                @nendo. | 
| 356 | 
            -
                @nendo. | 
| 357 | 
            -
                @nendo. | 
| 358 | 
            -
                @nendo. | 
| 359 | 
            -
                @nendo. | 
| 360 | 
            -
                @nendo. | 
| 361 | 
            -
                @nendo. | 
| 362 | 
            -
                @nendo. | 
| 363 | 
            -
                lambda { @nendo. | 
| 364 | 
            -
                lambda { @nendo. | 
| 365 | 
            -
                lambda { @nendo. | 
| 366 | 
            -
                lambda { @nendo. | 
| 367 | 
            -
                lambda { @nendo. | 
| 368 | 
            -
                lambda { @nendo. | 
| 369 | 
            -
                lambda { @nendo. | 
| 367 | 
            +
                @nendo.evalStr( " (* 1) " ).should == "1"
         | 
| 368 | 
            +
                @nendo.evalStr( " (* 2 1) " ).should == "2"
         | 
| 369 | 
            +
                @nendo.evalStr( " (* 2 5) " ).should == "10"
         | 
| 370 | 
            +
                @nendo.evalStr( " (* 1 2 3 4 5 6 7 8 9 10) " ).should == "3628800"
         | 
| 371 | 
            +
                @nendo.evalStr( " (* 100 (* 10 10 10)) " ).should == "100000"
         | 
| 372 | 
            +
                @nendo.evalStr( " (* 1.1 1) " ).should == "1.1"
         | 
| 373 | 
            +
                @nendo.evalStr( " (* 1.3 1.1) " ).should == (1.3*1.1).to_s
         | 
| 374 | 
            +
                @nendo.evalStr( " (*) " ).should == "1"
         | 
| 375 | 
            +
                lambda { @nendo.evalStr( " (* '() ) " ) }.should         raise_error(TypeError)
         | 
| 376 | 
            +
                lambda { @nendo.evalStr( " (* 1 '() ) " ) }.should       raise_error(TypeError)
         | 
| 377 | 
            +
                lambda { @nendo.evalStr( " (* 1.1 '() ) " ) }.should     raise_error(TypeError)
         | 
| 378 | 
            +
                lambda { @nendo.evalStr( " (* '(1) ) " ) }.should        raise_error(TypeError)
         | 
| 379 | 
            +
                lambda { @nendo.evalStr( " (* 1.1 \"a\" ) " ) }.should   raise_error(TypeError)
         | 
| 380 | 
            +
                lambda { @nendo.evalStr( " (* \"a\" 1) " ) }.should      raise_error(TypeError)
         | 
| 381 | 
            +
                lambda { @nendo.evalStr( " (* \"a\" 1.1) " ) }.should    raise_error(TypeError)
         | 
| 370 382 | 
             
              end
         | 
| 371 383 | 
             
            end
         | 
| 372 384 |  | 
| 373 | 
            -
            describe Nendo, "when call  | 
| 385 | 
            +
            describe Nendo, "when call evalStr() with `/' function" do
         | 
| 374 386 | 
             
              before do
         | 
| 375 387 | 
             
                @nendo = Nendo::Core.new()
         | 
| 376 388 | 
             
              end
         | 
| 377 389 | 
             
              it "should" do
         | 
| 378 | 
            -
                @nendo. | 
| 379 | 
            -
                @nendo. | 
| 390 | 
            +
                @nendo.evalStr( " (/ 1) " ).should == "1"
         | 
| 391 | 
            +
                @nendo.evalStr( " (/ 1.1) " ).should ==
         | 
| 380 392 | 
             
                  (1/1.1).to_s
         | 
| 381 | 
            -
                @nendo. | 
| 382 | 
            -
                @nendo. | 
| 383 | 
            -
                @nendo. | 
| 384 | 
            -
                @nendo. | 
| 385 | 
            -
                @nendo. | 
| 386 | 
            -
                @nendo. | 
| 387 | 
            -
                @nendo. | 
| 393 | 
            +
                @nendo.evalStr( " (/ 2 1) " ).should == "2"
         | 
| 394 | 
            +
                @nendo.evalStr( " (/ 2 2) " ).should == "1"
         | 
| 395 | 
            +
                @nendo.evalStr( " (/ 2 2.0) " ).should == "1.0"
         | 
| 396 | 
            +
                @nendo.evalStr( " (/ 2 5.0) " ).should == "0.4"
         | 
| 397 | 
            +
                @nendo.evalStr( " (/ 10.0 2 2 2 2 2 2 2 2 2 2) " ).should == "0.009765625"
         | 
| 398 | 
            +
                @nendo.evalStr( " (/ 100 (/ 100 10) 10) " ).should == "1"
         | 
| 399 | 
            +
                @nendo.evalStr( " (/ 1 1.11) " ).should ==
         | 
| 388 400 | 
             
                  (1/1.11).to_s
         | 
| 389 | 
            -
                @nendo. | 
| 401 | 
            +
                @nendo.evalStr( " (/ 1.3 1.1) " ).should ==
         | 
| 390 402 | 
             
                  (1.3/1.1).to_s
         | 
| 391 | 
            -
                lambda { @nendo. | 
| 392 | 
            -
                lambda { @nendo. | 
| 393 | 
            -
                lambda { @nendo. | 
| 394 | 
            -
                lambda { @nendo. | 
| 395 | 
            -
                lambda { @nendo. | 
| 403 | 
            +
                lambda { @nendo.evalStr( " (/ 1 '() ) " ) }.should      raise_error(TypeError)
         | 
| 404 | 
            +
                lambda { @nendo.evalStr( " (/ 1.1 '() ) " ) }.should    raise_error(TypeError)
         | 
| 405 | 
            +
                lambda { @nendo.evalStr( " (/) " ) }.should             raise_error(ArgumentError)
         | 
| 406 | 
            +
                lambda { @nendo.evalStr( " (/ '() ) " ) }.should        raise_error(TypeError)
         | 
| 407 | 
            +
                lambda { @nendo.evalStr( " (/ 1.1 \"a\" ) " ) }.should  raise_error(TypeError)
         | 
| 396 408 | 
             
              end
         | 
| 397 409 | 
             
            end
         | 
| 398 410 |  | 
| 399 | 
            -
            describe Nendo, "when call  | 
| 411 | 
            +
            describe Nendo, "when call evalStr() with `%' function" do
         | 
| 400 412 | 
             
              before do
         | 
| 401 413 | 
             
                @nendo = Nendo::Core.new()
         | 
| 402 414 | 
             
              end
         | 
| 403 415 | 
             
              it "should" do
         | 
| 404 | 
            -
                @nendo. | 
| 405 | 
            -
                @nendo. | 
| 406 | 
            -
                @nendo. | 
| 407 | 
            -
                @nendo. | 
| 408 | 
            -
                @nendo. | 
| 409 | 
            -
                @nendo. | 
| 410 | 
            -
                @nendo. | 
| 411 | 
            -
                @nendo. | 
| 412 | 
            -
                @nendo. | 
| 413 | 
            -
                lambda { @nendo. | 
| 414 | 
            -
                lambda { @nendo. | 
| 415 | 
            -
                lambda { @nendo. | 
| 416 | 
            -
                lambda { @nendo. | 
| 417 | 
            -
                lambda { @nendo. | 
| 416 | 
            +
                @nendo.evalStr( " (% 1) " ).should == "0"
         | 
| 417 | 
            +
                @nendo.evalStr( " (% 1.1) " ).should == "1.0"
         | 
| 418 | 
            +
                @nendo.evalStr( " (% 2 1) " ).should == "0"
         | 
| 419 | 
            +
                @nendo.evalStr( " (% 2 2) " ).should == "0"
         | 
| 420 | 
            +
                @nendo.evalStr( " (% 2 2.0) " ).should == "0.0"
         | 
| 421 | 
            +
                @nendo.evalStr( " (% 2 5.0) " ).should == "2.0"
         | 
| 422 | 
            +
                @nendo.evalStr( " (% 100 (% 103 10)) " ).should == "1"
         | 
| 423 | 
            +
                @nendo.evalStr( " (% 1 1.11) " ).should == "1.0"
         | 
| 424 | 
            +
                @nendo.evalStr( " (% 1.3 1.1) " ).should == (1.3%1.1).to_s
         | 
| 425 | 
            +
                lambda { @nendo.evalStr( " (% 1 '() ) " ) }.should       raise_error(TypeError)
         | 
| 426 | 
            +
                lambda { @nendo.evalStr( " (% 1.1 '() ) " ) }.should     raise_error(TypeError)
         | 
| 427 | 
            +
                lambda { @nendo.evalStr( " (\%) " ) }.should             raise_error(ArgumentError)
         | 
| 428 | 
            +
                lambda { @nendo.evalStr( " (\% '() ) " ) }.should        raise_error(TypeError)
         | 
| 429 | 
            +
                lambda { @nendo.evalStr( " (\% 1.1 \"a\" ) " ) }.should  raise_error(TypeError)
         | 
| 418 430 | 
             
              end
         | 
| 419 431 | 
             
            end
         | 
| 420 432 |  | 
| 421 | 
            -
            describe Nendo, "when call  | 
| 433 | 
            +
            describe Nendo, "when call evalStr() with `quotient' function" do
         | 
| 422 434 | 
             
              before do
         | 
| 423 435 | 
             
                @nendo = Nendo::Core.new()
         | 
| 424 436 | 
             
              end
         | 
| 425 437 | 
             
              it "should" do
         | 
| 426 | 
            -
                @nendo. | 
| 427 | 
            -
                @nendo. | 
| 428 | 
            -
                @nendo. | 
| 429 | 
            -
                @nendo. | 
| 430 | 
            -
                @nendo. | 
| 431 | 
            -
                @nendo. | 
| 432 | 
            -
                @nendo. | 
| 433 | 
            -
                @nendo. | 
| 434 | 
            -
                @nendo. | 
| 435 | 
            -
                lambda { @nendo. | 
| 436 | 
            -
                lambda { @nendo. | 
| 437 | 
            -
                lambda { @nendo. | 
| 438 | 
            -
                lambda { @nendo. | 
| 439 | 
            -
                lambda { @nendo. | 
| 440 | 
            -
                lambda { @nendo. | 
| 438 | 
            +
                @nendo.evalStr( " (quotient 2 1) " ).should == "2"
         | 
| 439 | 
            +
                @nendo.evalStr( " (quotient 2 2) " ).should == "1"
         | 
| 440 | 
            +
                @nendo.evalStr( " (quotient 2 2.0) " ).should == "1"
         | 
| 441 | 
            +
                @nendo.evalStr( " (quotient 2 5.0) " ).should == "0"
         | 
| 442 | 
            +
                @nendo.evalStr( " (quotient 1 1.11) " ).should == "0"
         | 
| 443 | 
            +
                @nendo.evalStr( " (quotient  10  3) " ).should == "3"
         | 
| 444 | 
            +
                @nendo.evalStr( " (quotient -10  3) " ).should == "-3"
         | 
| 445 | 
            +
                @nendo.evalStr( " (quotient  10 -3) " ).should == "-3"
         | 
| 446 | 
            +
                @nendo.evalStr( " (quotient  10 -2) " ).should == "-5"
         | 
| 447 | 
            +
                lambda { @nendo.evalStr( " (quotient 1 ) " ) }.should           raise_error(ArgumentError)
         | 
| 448 | 
            +
                lambda { @nendo.evalStr( " (quotient 1.1 ) " ) }.should         raise_error(ArgumentError)
         | 
| 449 | 
            +
                lambda { @nendo.evalStr( " (quotient) " ) }.should              raise_error(ArgumentError)
         | 
| 450 | 
            +
                lambda { @nendo.evalStr( " (quotient '() ) " ) }.should         raise_error(ArgumentError)
         | 
| 451 | 
            +
                lambda { @nendo.evalStr( " (quotient 1.1 \"a\" ) " ) }.should   raise_error(TypeError)
         | 
| 452 | 
            +
                lambda { @nendo.evalStr( " (quotient \"a\" 1.1 ) " ) }.should   raise_error(TypeError)
         | 
| 441 453 | 
             
              end
         | 
| 442 454 | 
             
            end
         | 
| 443 455 |  | 
| 444 | 
            -
            describe Nendo, "when call  | 
| 456 | 
            +
            describe Nendo, "when call evalStr() with `remainder' function" do
         | 
| 445 457 | 
             
              before do
         | 
| 446 458 | 
             
                @nendo = Nendo::Core.new()
         | 
| 447 459 | 
             
              end
         | 
| 448 460 | 
             
              it "should" do
         | 
| 449 | 
            -
                @nendo. | 
| 450 | 
            -
                @nendo. | 
| 451 | 
            -
                @nendo. | 
| 452 | 
            -
                @nendo. | 
| 453 | 
            -
                @nendo. | 
| 454 | 
            -
                @nendo. | 
| 455 | 
            -
                @nendo. | 
| 456 | 
            -
                @nendo. | 
| 457 | 
            -
                @nendo. | 
| 458 | 
            -
                @nendo. | 
| 459 | 
            -
                lambda { @nendo. | 
| 460 | 
            -
                lambda { @nendo. | 
| 461 | 
            -
                lambda { @nendo. | 
| 462 | 
            -
                lambda { @nendo. | 
| 463 | 
            -
                lambda { @nendo. | 
| 461 | 
            +
                @nendo.evalStr( " (remainder 2 1) " ).should == "0"
         | 
| 462 | 
            +
                @nendo.evalStr( " (remainder 2 2) " ).should == "0"
         | 
| 463 | 
            +
                @nendo.evalStr( " (remainder 2 2.0) " ).should == "0.0"
         | 
| 464 | 
            +
                @nendo.evalStr( " (remainder 2 5.0) " ).should == "2.0"
         | 
| 465 | 
            +
                @nendo.evalStr( " (remainder 1 1.11) " ).should == "1.0"
         | 
| 466 | 
            +
                @nendo.evalStr( " (remainder  10  3) " ).should == "1"
         | 
| 467 | 
            +
                @nendo.evalStr( " (remainder -10  3) " ).should == "-1"
         | 
| 468 | 
            +
                @nendo.evalStr( " (remainder  10 -3) " ).should == "1"
         | 
| 469 | 
            +
                @nendo.evalStr( " (remainder -10 -3) " ).should == "-1"
         | 
| 470 | 
            +
                @nendo.evalStr( " (remainder  10 -2) " ).should == "0"
         | 
| 471 | 
            +
                lambda { @nendo.evalStr( " (remainder 1 '() ) " ) }.should       raise_error(TypeError)
         | 
| 472 | 
            +
                lambda { @nendo.evalStr( " (remainder 1.1 '() ) " ) }.should     raise_error(TypeError)
         | 
| 473 | 
            +
                lambda { @nendo.evalStr( " (remainder) " ) }.should              raise_error(ArgumentError)
         | 
| 474 | 
            +
                lambda { @nendo.evalStr( " (remainder '() ) " ) }.should         raise_error(ArgumentError)
         | 
| 475 | 
            +
                lambda { @nendo.evalStr( " (remainder 1.1 \"a\" ) " ) }.should   raise_error(TypeError)
         | 
| 464 476 | 
             
              end
         | 
| 465 477 | 
             
            end
         | 
| 466 478 |  | 
| 467 | 
            -
            describe Nendo, "when call  | 
| 479 | 
            +
            describe Nendo, "when call evalStr() with `modulo' function" do
         | 
| 468 480 | 
             
              before do
         | 
| 469 481 | 
             
                @nendo = Nendo::Core.new()
         | 
| 470 482 | 
             
              end
         | 
| 471 483 | 
             
              it "should" do
         | 
| 472 | 
            -
                @nendo. | 
| 473 | 
            -
                @nendo. | 
| 474 | 
            -
                @nendo. | 
| 475 | 
            -
                @nendo. | 
| 476 | 
            -
                @nendo. | 
| 477 | 
            -
                @nendo. | 
| 478 | 
            -
                @nendo. | 
| 479 | 
            -
                @nendo. | 
| 480 | 
            -
                @nendo. | 
| 481 | 
            -
                @nendo. | 
| 482 | 
            -
                @nendo. | 
| 483 | 
            -
                lambda { @nendo. | 
| 484 | 
            -
                lambda { @nendo. | 
| 485 | 
            -
                lambda { @nendo. | 
| 486 | 
            -
                lambda { @nendo. | 
| 487 | 
            -
                lambda { @nendo. | 
| 484 | 
            +
                @nendo.evalStr( " (modulo 2 1) " ).should == "0"
         | 
| 485 | 
            +
                @nendo.evalStr( " (modulo 2 2) " ).should == "0"
         | 
| 486 | 
            +
                @nendo.evalStr( " (modulo 2 2.0) " ).should == "0.0"
         | 
| 487 | 
            +
                @nendo.evalStr( " (modulo 2 5.0) " ).should == "2.0"
         | 
| 488 | 
            +
                @nendo.evalStr( " (modulo 100 (modulo 103 10)) " ).should == "1"
         | 
| 489 | 
            +
                @nendo.evalStr( " (modulo 1 1.11) " ).should == "1.0"
         | 
| 490 | 
            +
                @nendo.evalStr( " (modulo  10  3) " ).should == "1"
         | 
| 491 | 
            +
                @nendo.evalStr( " (modulo -10  3) " ).should == "2"
         | 
| 492 | 
            +
                @nendo.evalStr( " (modulo  10 -3) " ).should == "-2"
         | 
| 493 | 
            +
                @nendo.evalStr( " (modulo -10 -3) " ).should == "-1"
         | 
| 494 | 
            +
                @nendo.evalStr( " (modulo  10 -2) " ).should == "0"
         | 
| 495 | 
            +
                lambda { @nendo.evalStr( " (modulo 1 '() ) " ) }.should       raise_error(TypeError)
         | 
| 496 | 
            +
                lambda { @nendo.evalStr( " (modulo 1.1 '() ) " ) }.should     raise_error(TypeError)
         | 
| 497 | 
            +
                lambda { @nendo.evalStr( " (modulo) " ) }.should              raise_error(ArgumentError)
         | 
| 498 | 
            +
                lambda { @nendo.evalStr( " (modulo '() ) " ) }.should         raise_error(TypeError)
         | 
| 499 | 
            +
                lambda { @nendo.evalStr( " (modulo 1.1 \"a\" ) " ) }.should   raise_error(TypeError)
         | 
| 488 500 | 
             
              end
         | 
| 489 501 | 
             
            end
         | 
| 490 502 |  | 
| @@ -493,50 +505,50 @@ describe Nendo, "when read various list expressions" do | |
| 493 505 | 
             
                @nendo = Nendo::Core.new()
         | 
| 494 506 | 
             
              end
         | 
| 495 507 | 
             
              it "should" do
         | 
| 496 | 
            -
                @nendo. | 
| 497 | 
            -
                @nendo. | 
| 498 | 
            -
                @nendo. | 
| 499 | 
            -
                @nendo. | 
| 500 | 
            -
                @nendo. | 
| 501 | 
            -
                @nendo. | 
| 502 | 
            -
                @nendo. | 
| 503 | 
            -
                @nendo. | 
| 504 | 
            -
                @nendo. | 
| 505 | 
            -
                @nendo. | 
| 506 | 
            -
                @nendo. | 
| 507 | 
            -
                @nendo. | 
| 508 | 
            -
                @nendo. | 
| 509 | 
            -
                @nendo. | 
| 510 | 
            -
                @nendo. | 
| 511 | 
            -
                @nendo. | 
| 512 | 
            -
                @nendo. | 
| 513 | 
            -
                @nendo. | 
| 514 | 
            -
                @nendo. | 
| 515 | 
            -
                @nendo. | 
| 516 | 
            -
                @nendo. | 
| 517 | 
            -
                @nendo. | 
| 518 | 
            -
                @nendo. | 
| 519 | 
            -
                @nendo. | 
| 520 | 
            -
                @nendo. | 
| 521 | 
            -
                @nendo. | 
| 522 | 
            -
                @nendo. | 
| 523 | 
            -
                @nendo. | 
| 524 | 
            -
                @nendo. | 
| 525 | 
            -
                @nendo. | 
| 526 | 
            -
                @nendo. | 
| 527 | 
            -
                @nendo. | 
| 528 | 
            -
                @nendo. | 
| 529 | 
            -
                @nendo. | 
| 530 | 
            -
                @nendo. | 
| 531 | 
            -
                @nendo. | 
| 532 | 
            -
                @nendo. | 
| 533 | 
            -
                @nendo. | 
| 534 | 
            -
                @nendo. | 
| 535 | 
            -
                @nendo. | 
| 536 | 
            -
                @nendo. | 
| 537 | 
            -
                @nendo. | 
| 538 | 
            -
                @nendo. | 
| 539 | 
            -
                @nendo. | 
| 508 | 
            +
                @nendo.evalStr( " '() " ).should == "()"
         | 
| 509 | 
            +
                @nendo.evalStr( " '[] " ).should == "()"
         | 
| 510 | 
            +
                @nendo.evalStr( " '(1 . 1) " ).should == "(1 . 1)"
         | 
| 511 | 
            +
                @nendo.evalStr( " '[1 . 1) " ).should == "(1 . 1)"
         | 
| 512 | 
            +
                @nendo.evalStr( " '(1 . 1] " ).should == "(1 . 1)"
         | 
| 513 | 
            +
                @nendo.evalStr( " '(1 1 . 1) " ).should == "(1 1 . 1)"
         | 
| 514 | 
            +
                @nendo.evalStr( " '(1 2 . 3) " ).should == "(1 2 . 3)"
         | 
| 515 | 
            +
                @nendo.evalStr( " '(1 2 3) " ).should == "(1 2 3)"
         | 
| 516 | 
            +
                @nendo.evalStr( " '(1.1 2.2 3.3) " ).should == "(1.1 2.2 3.3)"
         | 
| 517 | 
            +
                @nendo.evalStr( " '(a bb ccc dddd) " ).should == "(a bb ccc dddd)"
         | 
| 518 | 
            +
                @nendo.evalStr( " '(a (b) ((c)) (((d)))) " ).should == "(a (b) ((c)) (((d))))"
         | 
| 519 | 
            +
                @nendo.evalStr( " '[a (b) ((c)) (((d)))] " ).should == "(a (b) ((c)) (((d))))"
         | 
| 520 | 
            +
                @nendo.evalStr( " '(a [b] ([c]) (([d]))) " ).should == "(a (b) ((c)) (((d))))"
         | 
| 521 | 
            +
                @nendo.evalStr( " '[a [b] [[c]] [[[d]]]] " ).should == "(a (b) ((c)) (((d))))"
         | 
| 522 | 
            +
                @nendo.evalStr( " '('a)" ).should == "('a)"
         | 
| 523 | 
            +
                @nendo.evalStr( " '(''a)" ).should == "(''a)"
         | 
| 524 | 
            +
                @nendo.evalStr( " '('a 'b 'c)" ).should == "('a 'b 'c)"
         | 
| 525 | 
            +
                @nendo.evalStr( ' \'("str") ' ).should == '("str")'
         | 
| 526 | 
            +
                @nendo.evalStr( ' \'("str" . 1) ' ).should == '("str" . 1)'
         | 
| 527 | 
            +
                @nendo.evalStr( ' \'(1 . "str") ' ).should == '(1 . "str")'
         | 
| 528 | 
            +
                @nendo.evalStr( ' \'(1 2 . "str") ' ).should == '(1 2 . "str")'
         | 
| 529 | 
            +
                @nendo.evalStr( " '((a)(b)(c)) " ).should == "((a) (b) (c))"
         | 
| 530 | 
            +
                @nendo.evalStr( " 'a " ).should == "a"
         | 
| 531 | 
            +
                @nendo.evalStr( " 'symbol " ).should == "symbol"
         | 
| 532 | 
            +
                @nendo.evalStr( " 'SYMBOL " ).should == "SYMBOL"
         | 
| 533 | 
            +
                @nendo.evalStr( " 'SyMbOl " ).should == "SyMbOl"
         | 
| 534 | 
            +
                @nendo.evalStr( " ''a " ).should == "'a"
         | 
| 535 | 
            +
                @nendo.evalStr( " '1 " ).should == "1"
         | 
| 536 | 
            +
                @nendo.evalStr( " ''1 " ).should == "'1"
         | 
| 537 | 
            +
                @nendo.evalStr( " '''1 " ).should == "''1"
         | 
| 538 | 
            +
                @nendo.evalStr( " '1.1 " ).should == "1.1"
         | 
| 539 | 
            +
                @nendo.evalStr( " ''1.1 " ).should == "'1.1"
         | 
| 540 | 
            +
                @nendo.evalStr( " '''1.1 " ).should == "''1.1"
         | 
| 541 | 
            +
                @nendo.evalStr( " '() " ).should == "()"
         | 
| 542 | 
            +
                @nendo.evalStr( " '(()) " ).should == "(())"
         | 
| 543 | 
            +
                @nendo.evalStr( " '((())) " ).should == "((()))"
         | 
| 544 | 
            +
                @nendo.evalStr( " '(((()))) " ).should == "(((())))"
         | 
| 545 | 
            +
                @nendo.evalStr( " '(()  .  ()) " ).should == "(())"
         | 
| 546 | 
            +
                @nendo.evalStr( " '(a . ()) " ).should == "(a)"
         | 
| 547 | 
            +
                @nendo.evalStr( " '(a . #t) " ).should == "(a . #t)"
         | 
| 548 | 
            +
                @nendo.evalStr( " '(a . #f) " ).should == "(a . #f)"
         | 
| 549 | 
            +
                @nendo.evalStr( " '(a . nil) " ).should == "(a . nil)"
         | 
| 550 | 
            +
                @nendo.evalStr( " '(a b c d e  .  ()) " ).should == "(a b c d e)"
         | 
| 551 | 
            +
                @nendo.evalStr( " '(#t #t #f #f nil nil '() '()) " ).should == "(#t #t #f #f nil nil '() '())"
         | 
| 540 552 | 
             
              end
         | 
| 541 553 | 
             
            end
         | 
| 542 554 |  | 
| @@ -547,66 +559,174 @@ describe Nendo, "when use #xxxx syntax " do | |
| 547 559 | 
             
                @nendo.loadInitFile
         | 
| 548 560 | 
             
              end
         | 
| 549 561 | 
             
              it "should" do
         | 
| 550 | 
            -
                @nendo. | 
| 551 | 
            -
                @nendo. | 
| 552 | 
            -
                @nendo. | 
| 553 | 
            -
                @nendo. | 
| 554 | 
            -
                @nendo. | 
| 555 | 
            -
                @nendo. | 
| 556 | 
            -
                @nendo. | 
| 557 | 
            -
                @nendo. | 
| 558 | 
            -
                @nendo. | 
| 559 | 
            -
                @nendo. | 
| 560 | 
            -
                @nendo. | 
| 561 | 
            -
                @nendo. | 
| 562 | 
            -
                @nendo. | 
| 563 | 
            -
                lambda { @nendo. | 
| 564 | 
            -
                lambda { @nendo. | 
| 565 | 
            -
                lambda { @nendo. | 
| 566 | 
            -
                @nendo. | 
| 567 | 
            -
                @nendo. | 
| 568 | 
            -
                @nendo. | 
| 569 | 
            -
                @nendo. | 
| 570 | 
            -
                @nendo. | 
| 571 | 
            -
                @nendo. | 
| 572 | 
            -
                @nendo. | 
| 573 | 
            -
                lambda { @nendo. | 
| 574 | 
            -
                lambda { @nendo. | 
| 575 | 
            -
                lambda { @nendo. | 
| 576 | 
            -
                @nendo. | 
| 577 | 
            -
                @nendo. | 
| 578 | 
            -
                @nendo. | 
| 579 | 
            -
                @nendo. | 
| 580 | 
            -
                @nendo. | 
| 581 | 
            -
                @nendo. | 
| 582 | 
            -
                @nendo. | 
| 583 | 
            -
                lambda { @nendo. | 
| 584 | 
            -
                lambda { @nendo. | 
| 585 | 
            -
                @nendo. | 
| 586 | 
            -
                @nendo. | 
| 587 | 
            -
                @nendo. | 
| 588 | 
            -
                @nendo. | 
| 589 | 
            -
                @nendo. | 
| 590 | 
            -
                @nendo. | 
| 591 | 
            -
                @nendo. | 
| 592 | 
            -
                @nendo. | 
| 593 | 
            -
                @nendo. | 
| 594 | 
            -
                lambda { @nendo. | 
| 595 | 
            -
                lambda { @nendo. | 
| 596 | 
            -
                lambda { @nendo. | 
| 597 | 
            -
                lambda { @nendo. | 
| 598 | 
            -
                lambda { @nendo. | 
| 599 | 
            -
                lambda { @nendo. | 
| 600 | 
            -
                lambda { @nendo. | 
| 601 | 
            -
                lambda { @nendo. | 
| 602 | 
            -
                lambda { @nendo. | 
| 603 | 
            -
                lambda { @nendo. | 
| 604 | 
            -
                lambda { @nendo. | 
| 605 | 
            -
                lambda { @nendo. | 
| 606 | 
            -
                lambda { @nendo. | 
| 607 | 
            -
                lambda { @nendo. | 
| 608 | 
            -
                lambda { @nendo. | 
| 609 | 
            -
                lambda { @nendo. | 
| 562 | 
            +
                @nendo.evalStr( " #t " ).should == "#t"
         | 
| 563 | 
            +
                @nendo.evalStr( " #f " ).should == "#f"
         | 
| 564 | 
            +
                @nendo.evalStr( " '#( 1 ) " ).should == "#(1)"
         | 
| 565 | 
            +
                @nendo.evalStr( " '#() " ).should == "#()"
         | 
| 566 | 
            +
                @nendo.evalStr( " #!        \n #t" ).should == "#t"
         | 
| 567 | 
            +
                @nendo.evalStr( " #!        \n 100" ).should == "100"
         | 
| 568 | 
            +
                @nendo.evalStr( " #!   123  \n 100" ).should == "100"
         | 
| 569 | 
            +
                @nendo.evalStr( " '#?=1" ).should == "(debug-print 1 \"(string)\" 1 '1)"
         | 
| 570 | 
            +
                @nendo.evalStr( " #b0  " ).should == Integer("0b0").to_s
         | 
| 571 | 
            +
                @nendo.evalStr( " #b01 " ).should == Integer("0b01").to_s
         | 
| 572 | 
            +
                @nendo.evalStr( " #b10 " ).should == Integer("0b10").to_s
         | 
| 573 | 
            +
                @nendo.evalStr( " #b00000001 " ).should         == Integer("0b00000001").to_s
         | 
| 574 | 
            +
                @nendo.evalStr( " #b1010101010101010 " ).should == Integer("0b1010101010101010").to_s
         | 
| 575 | 
            +
                lambda { @nendo.evalStr( " #b2 " ) }.should      raise_error(RuntimeError)
         | 
| 576 | 
            +
                lambda { @nendo.evalStr( " #b02 " ) }.should     raise_error(RuntimeError)
         | 
| 577 | 
            +
                lambda { @nendo.evalStr( " #bF " ) }.should      raise_error(RuntimeError)
         | 
| 578 | 
            +
                @nendo.evalStr( " #o0  " ).should  == Integer("0o0").to_s
         | 
| 579 | 
            +
                @nendo.evalStr( " #o7  " ).should  == Integer("0o7").to_s
         | 
| 580 | 
            +
                @nendo.evalStr( " #o01 " ).should  == Integer("0o01").to_s
         | 
| 581 | 
            +
                @nendo.evalStr( " #o10 " ).should  == Integer("0o10").to_s
         | 
| 582 | 
            +
                @nendo.evalStr( " #o777 " ).should == Integer("0o777").to_s
         | 
| 583 | 
            +
                @nendo.evalStr( " #o00000007 " ).should         == Integer("0o00000007").to_s
         | 
| 584 | 
            +
                @nendo.evalStr( " #o0123456701234567 " ).should == Integer("0o0123456701234567").to_s
         | 
| 585 | 
            +
                lambda { @nendo.evalStr( " #o8 " ) }.should      raise_error(RuntimeError)
         | 
| 586 | 
            +
                lambda { @nendo.evalStr( " #o08 " ) }.should     raise_error(RuntimeError)
         | 
| 587 | 
            +
                lambda { @nendo.evalStr( " #oA " ) }.should      raise_error(RuntimeError)
         | 
| 588 | 
            +
                @nendo.evalStr( " #d0  " ).should  == Integer("0d0").to_s
         | 
| 589 | 
            +
                @nendo.evalStr( " #d9  " ).should  == Integer("0d9").to_s
         | 
| 590 | 
            +
                @nendo.evalStr( " #d01 " ).should  == Integer("0d01").to_s
         | 
| 591 | 
            +
                @nendo.evalStr( " #d10 " ).should  == Integer("0d10").to_s
         | 
| 592 | 
            +
                @nendo.evalStr( " #d999 " ).should == Integer("0d999").to_s
         | 
| 593 | 
            +
                @nendo.evalStr( " #d00000009 " ).should         == Integer("0d00000009").to_s
         | 
| 594 | 
            +
                @nendo.evalStr( " #d0123456701234567 " ).should == Integer("0d0123456701234567").to_s
         | 
| 595 | 
            +
                lambda { @nendo.evalStr( " #dA " ) }.should      raise_error(RuntimeError)
         | 
| 596 | 
            +
                lambda { @nendo.evalStr( " #dF " ) }.should      raise_error(RuntimeError)
         | 
| 597 | 
            +
                @nendo.evalStr( " #x0  " ).should  == Integer("0x0").to_s
         | 
| 598 | 
            +
                @nendo.evalStr( " #x9  " ).should  == Integer("0x9").to_s
         | 
| 599 | 
            +
                @nendo.evalStr( " #xA  " ).should  == Integer("0xA").to_s
         | 
| 600 | 
            +
                @nendo.evalStr( " #xF  " ).should  == Integer("0xF").to_s
         | 
| 601 | 
            +
                @nendo.evalStr( " #x01 " ).should  == Integer("0x01").to_s
         | 
| 602 | 
            +
                @nendo.evalStr( " #x10 " ).should  == Integer("0x10").to_s
         | 
| 603 | 
            +
                @nendo.evalStr( " #xFFF " ).should == Integer("0xFFF").to_s
         | 
| 604 | 
            +
                @nendo.evalStr( " #x0000000F " ).should         == Integer("0x0000000F").to_s
         | 
| 605 | 
            +
                @nendo.evalStr( " #x0123456789ABCDEF0123456789ABCDEF " ).should == Integer("0x0123456789ABCDEF0123456789ABCDEF").to_s
         | 
| 606 | 
            +
                lambda { @nendo.evalStr( " #xg " ) }.should      raise_error(RuntimeError)
         | 
| 607 | 
            +
                lambda { @nendo.evalStr( " #xh " ) }.should      raise_error(RuntimeError)
         | 
| 608 | 
            +
                lambda { @nendo.evalStr( " #xz " ) }.should      raise_error(RuntimeError)
         | 
| 609 | 
            +
                lambda { @nendo.evalStr( " #xG " ) }.should      raise_error(RuntimeError)
         | 
| 610 | 
            +
                lambda { @nendo.evalStr( " #xH " ) }.should      raise_error(RuntimeError)
         | 
| 611 | 
            +
                lambda { @nendo.evalStr( " #xZ " ) }.should      raise_error(RuntimeError)
         | 
| 612 | 
            +
                lambda { @nendo.evalStr( " #a " ) }.should       raise_error(NameError)
         | 
| 613 | 
            +
                lambda { @nendo.evalStr( " #c " ) }.should       raise_error(NameError)
         | 
| 614 | 
            +
                lambda { @nendo.evalStr( " #e " ) }.should       raise_error(NameError)
         | 
| 615 | 
            +
                lambda { @nendo.evalStr( " #tt " ) }.should      raise_error(NameError)
         | 
| 616 | 
            +
                lambda { @nendo.evalStr( " #ff " ) }.should      raise_error(NameError)
         | 
| 617 | 
            +
                lambda { @nendo.evalStr( " #abc " ) }.should     raise_error(NameError)
         | 
| 618 | 
            +
                lambda { @nendo.evalStr( " #? " ) }.should       raise_error(NameError)
         | 
| 619 | 
            +
                lambda { @nendo.evalStr( " #?a " ) }.should      raise_error(NameError)
         | 
| 620 | 
            +
                lambda { @nendo.evalStr( " #= " ) }.should       raise_error(NameError)
         | 
| 621 | 
            +
                lambda { @nendo.evalStr( " #?? " ) }.should      raise_error(NameError)
         | 
| 622 | 
            +
              end
         | 
| 623 | 
            +
            end
         | 
| 624 | 
            +
             | 
| 625 | 
            +
            describe Nendo, "when use regexp litteral and library functions " do
         | 
| 626 | 
            +
              before do
         | 
| 627 | 
            +
                @nendo = Nendo::Core.new()
         | 
| 628 | 
            +
                @nendo.loadInitFile
         | 
| 629 | 
            +
              end
         | 
| 630 | 
            +
              it "should" do
         | 
| 631 | 
            +
                @nendo.evalStr( " #/abc/ " ).should                                       == "#/abc/"
         | 
| 632 | 
            +
                @nendo.evalStr( " #/[a-z]/ " ).should                                     == "#/[a-z]/"
         | 
| 633 | 
            +
                @nendo.evalStr( " #/[a-zA-Z0-9]+/ " ).should                              == "#/[a-zA-Z0-9]+/"
         | 
| 634 | 
            +
                @nendo.evalStr( " #/\\d/ " ).should                                       == "#/\\d/"
         | 
| 635 | 
            +
                @nendo.evalStr( " #/[\\/]/ " ).should                                     == "#/[/]/"
         | 
| 636 | 
            +
                @nendo.evalStr( " #/abc/i " ).should                                      == "#/abc/i"
         | 
| 637 | 
            +
                @nendo.evalStr( " #/[a-z]/i " ).should                                    == "#/[a-z]/i"
         | 
| 638 | 
            +
                lambda { @nendo.evalStr( " #/[a-z]/I " ) }.should                         raise_error(NameError)
         | 
| 639 | 
            +
                lambda { @nendo.evalStr( " #/[a-z]/a " ) }.should                         raise_error(NameError)
         | 
| 640 | 
            +
                
         | 
| 641 | 
            +
                @nendo.evalStr( " (string->regexp \"abc\") " ).should                     == "#/abc/"
         | 
| 642 | 
            +
                @nendo.evalStr( " (string->regexp \"[a-z]\") " ).should                   == "#/[a-z]/"
         | 
| 643 | 
            +
                @nendo.evalStr( " (string->regexp \"[a-zA-Z0-9]+\" ) " ).should           == "#/[a-zA-Z0-9]+/"
         | 
| 644 | 
            +
                @nendo.evalStr( " (string->regexp \"\\\\d\" ) " ).should                  == "#/\\d/"
         | 
| 645 | 
            +
                @nendo.evalStr( " (regexp? #/str/ ) " ).should                            == "#t"
         | 
| 646 | 
            +
                @nendo.evalStr( " (regexp? #/str/i ) " ).should                           == "#t"
         | 
| 647 | 
            +
                @nendo.evalStr( " (regexp? \"str\" ) " ).should                           == "#f"
         | 
| 648 | 
            +
                @nendo.evalStr( " (regexp? 'str) " ).should                               == "#f"
         | 
| 649 | 
            +
                @nendo.evalStr( " (regexp? (. \"str\" intern)) " ).should                 == "#f"
         | 
| 650 | 
            +
                @nendo.evalStr( " (regexp? 100) " ).should                                == "#f"
         | 
| 651 | 
            +
             | 
| 652 | 
            +
                @nendo.evalStr( " (regexp->string #/abc/ ) " ).should                     == '"abc"'
         | 
| 653 | 
            +
                @nendo.evalStr( " (regexp->string #/[a-z]/ ) " ).should                   == '"[a-z]"'
         | 
| 654 | 
            +
                @nendo.evalStr( " (regexp->string #/[a-zA-Z0-9]+/ ) " ).should            == '"[a-zA-Z0-9]+"'
         | 
| 655 | 
            +
                @nendo.evalStr( ' (regexp->string #/\d+/ ) ' ).should                     == '"\\\\d+"'
         | 
| 656 | 
            +
             | 
| 657 | 
            +
                @nendo.evalStr( ' (define matchdata (rxmatch #/(\d+):(\d+)/ "foo314:2000bar")) ' ).should           == '314:2000'
         | 
| 658 | 
            +
                @nendo.evalStr( ' (rxmatch-start      matchdata) ' ).should                                         == '3'
         | 
| 659 | 
            +
                @nendo.evalStr( ' (rxmatch-start      matchdata 0) ' ).should                                       == '3'
         | 
| 660 | 
            +
                @nendo.evalStr( ' (rxmatch-start      matchdata 1) ' ).should                                       == '3'
         | 
| 661 | 
            +
                @nendo.evalStr( ' (rxmatch-start      matchdata 2) ' ).should                                       == '7'
         | 
| 662 | 
            +
                @nendo.evalStr( ' (rxmatch-end        matchdata) ' ).should                                         == '11'
         | 
| 663 | 
            +
                @nendo.evalStr( ' (rxmatch-end        matchdata 0) ' ).should                                       == '11'
         | 
| 664 | 
            +
                @nendo.evalStr( ' (rxmatch-end        matchdata 1) ' ).should                                       == '6'
         | 
| 665 | 
            +
                @nendo.evalStr( ' (rxmatch-end        matchdata 2) ' ).should                                       == '11'
         | 
| 666 | 
            +
                @nendo.evalStr( ' (rxmatch-substring  matchdata) ' ).should                                         == '"314:2000"'
         | 
| 667 | 
            +
                @nendo.evalStr( ' (rxmatch-substring  matchdata 0) ' ).should                                       == '"314:2000"'
         | 
| 668 | 
            +
                @nendo.evalStr( ' (rxmatch-substring  matchdata 1) ' ).should                                       == '"314"'
         | 
| 669 | 
            +
                @nendo.evalStr( ' (rxmatch-substring  matchdata 2) ' ).should                                       == '"2000"'
         | 
| 670 | 
            +
                @nendo.evalStr( ' (rxmatch-num-matches matchdata) ' ).should                                        == '3'
         | 
| 671 | 
            +
             | 
| 672 | 
            +
                @nendo.evalStr( ' (define matchdata (rxmatch #/(\w+)@([\w.]+)/ "foo@example.com")) ' ).should       == 'foo@example.com'
         | 
| 673 | 
            +
                @nendo.evalStr( ' (rxmatch-substring  matchdata) ' ).should                                         == '"foo@example.com"'
         | 
| 674 | 
            +
                @nendo.evalStr( ' (rxmatch-substring  matchdata 0) ' ).should                                       == '"foo@example.com"'
         | 
| 675 | 
            +
                @nendo.evalStr( ' (rxmatch-substring  matchdata 1) ' ).should                                       == '"foo"'
         | 
| 676 | 
            +
                @nendo.evalStr( ' (rxmatch-substring  matchdata 2) ' ).should                                       == '"example.com"'
         | 
| 677 | 
            +
             | 
| 678 | 
            +
                @nendo.evalStr( ' (rxmatch->string #/(\w+)@([\w.]+)/ "foo@example.com")' ).should                   == '"foo@example.com"'
         | 
| 679 | 
            +
                @nendo.evalStr( ' (rxmatch->string #/(\w+)@([\w.]+)/ "foo@example.com" 0)' ).should                 == '"foo@example.com"'
         | 
| 680 | 
            +
                @nendo.evalStr( ' (rxmatch->string #/(\w+)@([\w.]+)/ "foo@example.com" 1)' ).should                 == '"foo"'
         | 
| 681 | 
            +
                @nendo.evalStr( ' (rxmatch->string #/(\w+)@([\w.]+)/ "foo@example.com" 2)' ).should                 == '"example.com"'
         | 
| 682 | 
            +
             | 
| 683 | 
            +
                @nendo.evalStr( ' (rxmatch->string #/abc/  "000abc00ABC000")' ).should                              == '"abc"'
         | 
| 684 | 
            +
                @nendo.evalStr( ' (rxmatch->string #/ABC/  "000abc00ABC000")' ).should                              == '"ABC"'
         | 
| 685 | 
            +
                @nendo.evalStr( ' (rxmatch->string #/abc/i "abc")' ).should                                         == '"abc"'
         | 
| 686 | 
            +
                @nendo.evalStr( ' (rxmatch->string #/abc/i "ABC")' ).should                                         == '"ABC"'
         | 
| 687 | 
            +
                @nendo.evalStr( ' (rxmatch->string #/ABC/i "abc")' ).should                                         == '"abc"'
         | 
| 688 | 
            +
                @nendo.evalStr( ' (rxmatch->string #/abc/i "AbC")' ).should                                         == '"AbC"'
         | 
| 689 | 
            +
             | 
| 690 | 
            +
                @nendo.evalStr( ' (rxmatch            #/abc/i "xxx")' ).should                                         == '#f'
         | 
| 691 | 
            +
                @nendo.evalStr( ' (rxmatch            #/XXX/  "xxx")' ).should                                         == '#f'
         | 
| 692 | 
            +
                @nendo.evalStr( ' (rxmatch->string    #/abc/i "xxx")' ).should                                         == '#f'
         | 
| 693 | 
            +
                @nendo.evalStr( ' (rxmatch->string    #/XXX/  "xxx")' ).should                                         == '#f'
         | 
| 694 | 
            +
             | 
| 695 | 
            +
                pending( "JRuby can't compute correctly" ) if defined? JRUBY_VERSION
         | 
| 696 | 
            +
                @nendo.evalStr( ' (define matchdata (rxmatch #/([あ-ん])([あ-ん])([あ-ん])([あ-ん])([あ-ん])/ "ABC漢字あいうえお漢字ABC")) ' ).should  == 'あいうえお'
         | 
| 697 | 
            +
                @nendo.evalStr( ' (rxmatch-start      matchdata) ' ).should                                         == '5'
         | 
| 698 | 
            +
                @nendo.evalStr( ' (rxmatch-end        matchdata) ' ).should                                         == '10'
         | 
| 699 | 
            +
                @nendo.evalStr( ' (rxmatch-substring  matchdata) ' ).should                                         == '"あいうえお"'
         | 
| 700 | 
            +
                @nendo.evalStr( ' (rxmatch-substring  matchdata 1) ' ).should                                       == '"あ"'
         | 
| 701 | 
            +
                @nendo.evalStr( ' (rxmatch-substring  matchdata 2) ' ).should                                       == '"い"'
         | 
| 702 | 
            +
                @nendo.evalStr( ' (rxmatch-substring  matchdata 3) ' ).should                                       == '"う"'
         | 
| 703 | 
            +
              end
         | 
| 704 | 
            +
            end
         | 
| 705 | 
            +
             | 
| 706 | 
            +
             | 
| 707 | 
            +
            class TestClassForBlockArgument
         | 
| 708 | 
            +
              def arg1
         | 
| 709 | 
            +
                yield 100
         | 
| 710 | 
            +
              end
         | 
| 711 | 
            +
              def arg2
         | 
| 712 | 
            +
                yield 100,200
         | 
| 713 | 
            +
              end
         | 
| 714 | 
            +
              def arg5
         | 
| 715 | 
            +
                yield 10,20,30,40,50
         | 
| 716 | 
            +
              end
         | 
| 717 | 
            +
            end
         | 
| 718 | 
            +
             | 
| 719 | 
            +
            describe Nendo, "when use &block(Ruby's block) " do
         | 
| 720 | 
            +
              before do
         | 
| 721 | 
            +
                @nendo = Nendo::Core.new()
         | 
| 722 | 
            +
              end
         | 
| 723 | 
            +
             | 
| 724 | 
            +
              it "should" do
         | 
| 725 | 
            +
                @nendo.evalStr( " (define testclass (TestClassForBlockArgument.new))  testclass.class" ).should == "TestClassForBlockArgument"
         | 
| 726 | 
            +
                @nendo.evalStr( " (testclass.arg1 (&block (a)    (list a)))  " ).should == "(100)"
         | 
| 727 | 
            +
                @nendo.evalStr( " (testclass.arg2 (&block (a b)  (cons a b))) " ).should == "(100 . 200)"
         | 
| 728 | 
            +
                @nendo.evalStr( " (testclass.arg5 (&block (a b c d e)  (list a b c d e))) " ).should == "(10 20 30 40 50)"
         | 
| 729 | 
            +
                @nendo.evalStr( " (testclass.arg5 (&block (a b c d e)  (to-arr (list a b c d e)))) " ).should == "#(10 20 30 40 50)"
         | 
| 610 730 | 
             
              end
         | 
| 611 731 | 
             
            end
         | 
| 612 732 |  | 
| @@ -615,272 +735,272 @@ describe Nendo, "when read various vector expressions" do | |
| 615 735 | 
             
                @nendo = Nendo::Core.new()
         | 
| 616 736 | 
             
              end
         | 
| 617 737 | 
             
              it "should" do
         | 
| 618 | 
            -
                @nendo. | 
| 619 | 
            -
                @nendo. | 
| 620 | 
            -
                @nendo. | 
| 621 | 
            -
                lambda { @nendo. | 
| 622 | 
            -
                @nendo. | 
| 623 | 
            -
                @nendo. | 
| 624 | 
            -
                @nendo. | 
| 625 | 
            -
                lambda { @nendo. | 
| 626 | 
            -
                lambda { @nendo. | 
| 627 | 
            -
                @nendo. | 
| 628 | 
            -
                @nendo. | 
| 629 | 
            -
                @nendo. | 
| 630 | 
            -
                @nendo. | 
| 631 | 
            -
                @nendo. | 
| 632 | 
            -
                @nendo. | 
| 633 | 
            -
                @nendo. | 
| 634 | 
            -
                @nendo. | 
| 738 | 
            +
                @nendo.evalStr( " '() " ).should == "()"
         | 
| 739 | 
            +
                @nendo.evalStr( " '[] " ).should == "()"
         | 
| 740 | 
            +
                @nendo.evalStr( " '#( 1 ) " ).should == "#(1)"
         | 
| 741 | 
            +
                lambda { @nendo.evalStr( " '#(( 1 ) " )    }.should                               raise_error( RuntimeError )
         | 
| 742 | 
            +
                @nendo.evalStr( " '#( 1 2 ) " ).should == "#(1 2)"
         | 
| 743 | 
            +
                @nendo.evalStr( " '#( 1 () ) " ).should == "#(1 ())"
         | 
| 744 | 
            +
                @nendo.evalStr( " '#( () 2 ) " ).should == "#(() 2)"
         | 
| 745 | 
            +
                lambda { @nendo.evalStr( " '#( 1 . 2 ) " ) }.should                               raise_error( RuntimeError )
         | 
| 746 | 
            +
                lambda { @nendo.evalStr( " #(+ 1 2) " )    }.should                               raise_error( RuntimeError )
         | 
| 747 | 
            +
                @nendo.evalStr( " '#( 1 #( 11 )) " ).should == "#(1 #(11))"
         | 
| 748 | 
            +
                @nendo.evalStr( " '#( 1 #( 11 12 )) " ).should == "#(1 #(11 12))"
         | 
| 749 | 
            +
                @nendo.evalStr( " '#( 1 #( 11 #( 111 ))) " ).should == "#(1 #(11 #(111)))"
         | 
| 750 | 
            +
                @nendo.evalStr( " '#( 1 #( 11 #( 111 112))) " ).should == "#(1 #(11 #(111 112)))"
         | 
| 751 | 
            +
                @nendo.evalStr( " '#(1 2 3) " ).should == "#(1 2 3)"
         | 
| 752 | 
            +
                @nendo.evalStr( " '#(1.1 2.2 3.3) " ).should == "#(1.1 2.2 3.3)"
         | 
| 753 | 
            +
                @nendo.evalStr( " '#(a bb ccc dddd) " ).should == "#(a bb ccc dddd)"
         | 
| 754 | 
            +
                @nendo.evalStr( " '#(a (b) ((c)) (((d)))) " ).should == "#(a (b) ((c)) (((d))))"
         | 
| 635 755 | 
             
              end
         | 
| 636 756 | 
             
            end
         | 
| 637 757 |  | 
| 638 | 
            -
            describe Nendo, "when call  | 
| 758 | 
            +
            describe Nendo, "when call evalStr() with built-in functions" do
         | 
| 639 759 | 
             
              before do
         | 
| 640 760 | 
             
                @nendo = Nendo::Core.new()
         | 
| 641 761 | 
             
              end
         | 
| 642 762 | 
             
              it "should" do
         | 
| 643 | 
            -
                @nendo. | 
| 644 | 
            -
                @nendo. | 
| 645 | 
            -
                @nendo. | 
| 646 | 
            -
                @nendo. | 
| 647 | 
            -
                @nendo. | 
| 648 | 
            -
                @nendo. | 
| 649 | 
            -
                @nendo. | 
| 650 | 
            -
                @nendo. | 
| 651 | 
            -
                @nendo. | 
| 652 | 
            -
                @nendo. | 
| 653 | 
            -
                @nendo. | 
| 654 | 
            -
                @nendo. | 
| 655 | 
            -
                @nendo. | 
| 656 | 
            -
                @nendo. | 
| 657 | 
            -
                @nendo. | 
| 658 | 
            -
                @nendo. | 
| 659 | 
            -
                @nendo. | 
| 660 | 
            -
                @nendo. | 
| 661 | 
            -
                @nendo. | 
| 662 | 
            -
                lambda { @nendo. | 
| 663 | 
            -
                lambda { @nendo. | 
| 664 | 
            -
                lambda { @nendo. | 
| 665 | 
            -
                @nendo. | 
| 666 | 
            -
                @nendo. | 
| 667 | 
            -
                @nendo. | 
| 668 | 
            -
                @nendo. | 
| 669 | 
            -
                @nendo. | 
| 670 | 
            -
                @nendo. | 
| 671 | 
            -
                @nendo. | 
| 672 | 
            -
                @nendo. | 
| 673 | 
            -
                @nendo. | 
| 674 | 
            -
                @nendo. | 
| 675 | 
            -
                @nendo. | 
| 676 | 
            -
                @nendo. | 
| 677 | 
            -
                @nendo. | 
| 678 | 
            -
                @nendo. | 
| 679 | 
            -
                @nendo. | 
| 680 | 
            -
                @nendo. | 
| 681 | 
            -
                @nendo. | 
| 682 | 
            -
                @nendo. | 
| 683 | 
            -
                @nendo. | 
| 684 | 
            -
                @nendo. | 
| 685 | 
            -
                @nendo. | 
| 686 | 
            -
                @nendo. | 
| 687 | 
            -
                @nendo. | 
| 688 | 
            -
                @nendo. | 
| 689 | 
            -
                @nendo. | 
| 690 | 
            -
                @nendo. | 
| 691 | 
            -
                @nendo. | 
| 692 | 
            -
                @nendo. | 
| 693 | 
            -
                @nendo. | 
| 694 | 
            -
                @nendo. | 
| 695 | 
            -
                @nendo. | 
| 696 | 
            -
                @nendo. | 
| 697 | 
            -
                @nendo. | 
| 698 | 
            -
                @nendo. | 
| 699 | 
            -
                @nendo. | 
| 700 | 
            -
                @nendo. | 
| 701 | 
            -
                @nendo. | 
| 702 | 
            -
                @nendo. | 
| 703 | 
            -
                @nendo. | 
| 704 | 
            -
                @nendo. | 
| 705 | 
            -
                @nendo. | 
| 706 | 
            -
                @nendo. | 
| 707 | 
            -
                @nendo. | 
| 708 | 
            -
                @nendo. | 
| 709 | 
            -
                @nendo. | 
| 710 | 
            -
                @nendo. | 
| 711 | 
            -
                @nendo. | 
| 712 | 
            -
                @nendo. | 
| 713 | 
            -
                @nendo. | 
| 714 | 
            -
                @nendo. | 
| 715 | 
            -
                @nendo. | 
| 716 | 
            -
                @nendo. | 
| 717 | 
            -
                @nendo. | 
| 718 | 
            -
                @nendo. | 
| 719 | 
            -
                @nendo. | 
| 720 | 
            -
                @nendo. | 
| 721 | 
            -
                @nendo. | 
| 722 | 
            -
                @nendo. | 
| 723 | 
            -
                @nendo. | 
| 724 | 
            -
                @nendo. | 
| 725 | 
            -
                @nendo. | 
| 726 | 
            -
                @nendo. | 
| 727 | 
            -
                @nendo. | 
| 728 | 
            -
                @nendo. | 
| 729 | 
            -
                @nendo. | 
| 730 | 
            -
                @nendo. | 
| 731 | 
            -
                @nendo. | 
| 732 | 
            -
                @nendo. | 
| 733 | 
            -
                @nendo. | 
| 734 | 
            -
                @nendo. | 
| 735 | 
            -
                @nendo. | 
| 736 | 
            -
                @nendo. | 
| 737 | 
            -
                @nendo. | 
| 738 | 
            -
                @nendo. | 
| 739 | 
            -
                @nendo. | 
| 740 | 
            -
                @nendo. | 
| 741 | 
            -
                @nendo. | 
| 742 | 
            -
                @nendo. | 
| 743 | 
            -
                @nendo. | 
| 744 | 
            -
                @nendo. | 
| 745 | 
            -
                @nendo. | 
| 746 | 
            -
                @nendo. | 
| 747 | 
            -
                @nendo. | 
| 748 | 
            -
                @nendo. | 
| 749 | 
            -
                @nendo. | 
| 750 | 
            -
                @nendo. | 
| 751 | 
            -
                @nendo. | 
| 752 | 
            -
                @nendo. | 
| 753 | 
            -
                @nendo. | 
| 754 | 
            -
                @nendo. | 
| 755 | 
            -
                @nendo. | 
| 756 | 
            -
                @nendo. | 
| 757 | 
            -
                @nendo. | 
| 758 | 
            -
                @nendo. | 
| 759 | 
            -
                @nendo. | 
| 760 | 
            -
                @nendo. | 
| 761 | 
            -
                @nendo. | 
| 762 | 
            -
                @nendo. | 
| 763 | 
            -
                @nendo. | 
| 764 | 
            -
                @nendo. | 
| 765 | 
            -
                @nendo. | 
| 766 | 
            -
                @nendo. | 
| 767 | 
            -
                @nendo. | 
| 768 | 
            -
                @nendo. | 
| 769 | 
            -
                @nendo. | 
| 770 | 
            -
                @nendo. | 
| 771 | 
            -
                @nendo. | 
| 772 | 
            -
                lambda { @nendo. | 
| 773 | 
            -
                lambda { @nendo. | 
| 774 | 
            -
                @nendo. | 
| 775 | 
            -
                @nendo. | 
| 776 | 
            -
                @nendo. | 
| 777 | 
            -
                @nendo. | 
| 778 | 
            -
                @nendo. | 
| 779 | 
            -
                lambda { @nendo. | 
| 780 | 
            -
                lambda { @nendo. | 
| 763 | 
            +
                @nendo.evalStr( " (car '(1 2 3 4)) " ).should == "1"
         | 
| 764 | 
            +
                @nendo.evalStr( " (cdr '(1 2 3 4)) " ).should == "(2 3 4)"
         | 
| 765 | 
            +
                @nendo.evalStr( " (null? '()) " ).should == "#t"
         | 
| 766 | 
            +
                @nendo.evalStr( " (null? '(1)) " ).should == "#f"
         | 
| 767 | 
            +
                @nendo.evalStr( " (null? false) " ).should == "#f"
         | 
| 768 | 
            +
                @nendo.evalStr( " (null? nil) " ).should == "#f"
         | 
| 769 | 
            +
                @nendo.evalStr( " (null? true) " ).should == "#f"
         | 
| 770 | 
            +
                @nendo.evalStr( " (cons 1 2) " ).should == "(1 . 2)"
         | 
| 771 | 
            +
                @nendo.evalStr( " (cons 1 '(2 3)) " ).should == "(1 2 3)"
         | 
| 772 | 
            +
                @nendo.evalStr( " (cons '(1 2) '(3 4)) " ).should == "((1 2) 3 4)"
         | 
| 773 | 
            +
                @nendo.evalStr( " (cons '(1 2) '((3 4))) " ).should == "((1 2) (3 4))"
         | 
| 774 | 
            +
                @nendo.evalStr( " (cons '() '()) " ).should == "(())"
         | 
| 775 | 
            +
                @nendo.evalStr( " (cons '() (cdr '(100))) " ).should == "(())"
         | 
| 776 | 
            +
                @nendo.evalStr( " (cons '() (car '(()))) " ).should == "(())"
         | 
| 777 | 
            +
                @nendo.evalStr( " (cons (car '(())) '()) " ).should == "(())"
         | 
| 778 | 
            +
                @nendo.evalStr( " (cons (car '(())) (car '(()))) " ).should == "(())"
         | 
| 779 | 
            +
                @nendo.evalStr( " (cons '() (cdr '(100))) " ).should == "(())"
         | 
| 780 | 
            +
                @nendo.evalStr( " (cons (cdr '(100)) '()) " ).should == "(())"
         | 
| 781 | 
            +
                @nendo.evalStr( " (cons (cdr '(100)) (cdr '(100))) " ).should == "(())"
         | 
| 782 | 
            +
                lambda { @nendo.evalStr( " (cons 1 2 3) " ) }.should    raise_error(ArgumentError)
         | 
| 783 | 
            +
                lambda { @nendo.evalStr( " (cons 1) " ) }.should        raise_error(ArgumentError)
         | 
| 784 | 
            +
                lambda { @nendo.evalStr( " (cons) " ) }.should          raise_error(ArgumentError)
         | 
| 785 | 
            +
                @nendo.evalStr( " (list 1 2 3) " ).should == "(1 2 3)"
         | 
| 786 | 
            +
                @nendo.evalStr( " (list '(1) '(2) '(3)) " ).should == "((1) (2) (3))"
         | 
| 787 | 
            +
                @nendo.evalStr( " (list 'a 'b 'c) " ).should == "(a b c)"
         | 
| 788 | 
            +
                @nendo.evalStr( " (list '(a) '((b c))) " ).should == "((a) ((b c)))"
         | 
| 789 | 
            +
                @nendo.evalStr( " (list) " ).should == "()"
         | 
| 790 | 
            +
                @nendo.evalStr( " (list 1) " ).should == "(1)"
         | 
| 791 | 
            +
                @nendo.evalStr( " (define !a 10) !a" ).should == "10"
         | 
| 792 | 
            +
                @nendo.evalStr( " (define $a 11) $a" ).should == "11"
         | 
| 793 | 
            +
                @nendo.evalStr( " (define %a 12) %a" ).should == "12"
         | 
| 794 | 
            +
                @nendo.evalStr( " (define &a 13) &a" ).should == "13"
         | 
| 795 | 
            +
                @nendo.evalStr( " (define *a 14) *a" ).should == "14"
         | 
| 796 | 
            +
                @nendo.evalStr( " (define +a 15) +a" ).should == "15"
         | 
| 797 | 
            +
                @nendo.evalStr( " (define -a 16) -a" ).should == "16"
         | 
| 798 | 
            +
                @nendo.evalStr( " (define /a 17) /a" ).should == "17"
         | 
| 799 | 
            +
                @nendo.evalStr( " (define <a 18) <a" ).should == "18"
         | 
| 800 | 
            +
                @nendo.evalStr( " (define =a 19) =a" ).should == "19"
         | 
| 801 | 
            +
                @nendo.evalStr( " (define ?a 20) ?a" ).should == "20"
         | 
| 802 | 
            +
                @nendo.evalStr( " (define @a 21) @a" ).should == "21"
         | 
| 803 | 
            +
                @nendo.evalStr( " (define ^a 22) ^a" ).should == "22"
         | 
| 804 | 
            +
                @nendo.evalStr( " (define ~a 23) ~a" ).should == "23"
         | 
| 805 | 
            +
                @nendo.evalStr( " (define a! 30) a!" ).should == "30"
         | 
| 806 | 
            +
                @nendo.evalStr( " (define a$ 31) a$" ).should == "31"
         | 
| 807 | 
            +
                @nendo.evalStr( " (define a% 32) a%" ).should == "32"
         | 
| 808 | 
            +
                @nendo.evalStr( " (define a& 33) a&" ).should == "33"
         | 
| 809 | 
            +
                @nendo.evalStr( " (define a* 34) a*" ).should == "34"
         | 
| 810 | 
            +
                @nendo.evalStr( " (define a+ 35) a+" ).should == "35"
         | 
| 811 | 
            +
                @nendo.evalStr( " (define a- 36) a-" ).should == "36"
         | 
| 812 | 
            +
                @nendo.evalStr( " (define a/ 37) a/" ).should == "37"
         | 
| 813 | 
            +
                @nendo.evalStr( " (define a< 38) a<" ).should == "38"
         | 
| 814 | 
            +
                @nendo.evalStr( " (define a= 39) a=" ).should == "39"
         | 
| 815 | 
            +
                @nendo.evalStr( " (define a? 40) a?" ).should == "40"
         | 
| 816 | 
            +
                @nendo.evalStr( " (define a@ 41) a@" ).should == "41"
         | 
| 817 | 
            +
                @nendo.evalStr( " (define a^ 42) a^" ).should == "42"
         | 
| 818 | 
            +
                @nendo.evalStr( " (define a~ 43) a~" ).should == "43"
         | 
| 819 | 
            +
                @nendo.evalStr( " (define aFunc (lambda (x) x)) true" ).should == "#t"
         | 
| 820 | 
            +
                @nendo.evalStr( " (define aMacro (macro (x) x)) true" ).should == "#t"
         | 
| 821 | 
            +
                @nendo.evalStr( " (define a! 123) a!" ).should == "123"
         | 
| 822 | 
            +
                @nendo.evalStr( " (define b? 321) b?" ).should == "321"
         | 
| 823 | 
            +
                @nendo.evalStr( " (define a-b 1234) a-b" ).should == "1234"
         | 
| 824 | 
            +
                @nendo.evalStr( " (define start-end!? 4321) start-end!?" ).should == "4321"
         | 
| 825 | 
            +
                @nendo.evalStr( " (procedure? car) " ).should == "#t"
         | 
| 826 | 
            +
                @nendo.evalStr( " (procedure? aFunc) " ).should == "#t"
         | 
| 827 | 
            +
                @nendo.evalStr( " (procedure? aMacro) " ).should == "#f"
         | 
| 828 | 
            +
                @nendo.evalStr( " (procedure? 1) " ).should == "#f"
         | 
| 829 | 
            +
                @nendo.evalStr( " (procedure? 1.1) " ).should == "#f"
         | 
| 830 | 
            +
                @nendo.evalStr( " (procedure? \"str\") " ).should == "#f"
         | 
| 831 | 
            +
                @nendo.evalStr( " (procedure? 'a) " ).should == "#f"
         | 
| 832 | 
            +
                @nendo.evalStr( " (procedure? '(1)) " ).should == "#f"
         | 
| 833 | 
            +
                @nendo.evalStr( " (procedure? '()) " ).should == "#f"
         | 
| 834 | 
            +
                @nendo.evalStr( " (symbol? car) " ).should == "#f"
         | 
| 835 | 
            +
                @nendo.evalStr( " (symbol? aFunc) " ).should == "#f"
         | 
| 836 | 
            +
                @nendo.evalStr( " (symbol? aMacro) " ).should == "#f"
         | 
| 837 | 
            +
                @nendo.evalStr( " (symbol? 1) " ).should == "#f"
         | 
| 838 | 
            +
                @nendo.evalStr( " (symbol? 1.1) " ).should == "#f"
         | 
| 839 | 
            +
                @nendo.evalStr( " (symbol? \"str\") " ).should == "#f"
         | 
| 840 | 
            +
                @nendo.evalStr( " (symbol? 'a) " ).should == "#t"
         | 
| 841 | 
            +
                @nendo.evalStr( " (symbol? '(1)) " ).should == "#f"
         | 
| 842 | 
            +
                @nendo.evalStr( " (symbol? '()) " ).should == "#f"
         | 
| 843 | 
            +
                @nendo.evalStr( " (pair? car) " ).should == "#f"
         | 
| 844 | 
            +
                @nendo.evalStr( " (pair? aFunc) " ).should == "#f"
         | 
| 845 | 
            +
                @nendo.evalStr( " (pair? aMacro) " ).should == "#f"
         | 
| 846 | 
            +
                @nendo.evalStr( " (pair? 1) " ).should == "#f"
         | 
| 847 | 
            +
                @nendo.evalStr( " (pair? 1.1) " ).should == "#f"
         | 
| 848 | 
            +
                @nendo.evalStr( " (pair? \"str\") " ).should == "#f"
         | 
| 849 | 
            +
                @nendo.evalStr( " (pair? 'a) " ).should == "#f"
         | 
| 850 | 
            +
                @nendo.evalStr( " (pair? '(1)) " ).should == "#t"
         | 
| 851 | 
            +
                @nendo.evalStr( " (pair? '()) " ).should == "#f"
         | 
| 852 | 
            +
                @nendo.evalStr( " (number? car) " ).should == "#f"
         | 
| 853 | 
            +
                @nendo.evalStr( " (number? aFunc) " ).should == "#f"
         | 
| 854 | 
            +
                @nendo.evalStr( " (number? aMacro) " ).should == "#f"
         | 
| 855 | 
            +
                @nendo.evalStr( " (number? 1) " ).should == "#t"
         | 
| 856 | 
            +
                @nendo.evalStr( " (number? 1.1) " ).should == "#t"
         | 
| 857 | 
            +
                @nendo.evalStr( " (number? \"str\") " ).should == "#f"
         | 
| 858 | 
            +
                @nendo.evalStr( " (number? 'a) " ).should == "#f"
         | 
| 859 | 
            +
                @nendo.evalStr( " (number? '(1)) " ).should == "#f"
         | 
| 860 | 
            +
                @nendo.evalStr( " (number? '()) " ).should == "#f"
         | 
| 861 | 
            +
                @nendo.evalStr( " (integer? car) " ).should == "#f"
         | 
| 862 | 
            +
                @nendo.evalStr( " (integer? aFunc) " ).should == "#f"
         | 
| 863 | 
            +
                @nendo.evalStr( " (integer? aMacro) " ).should == "#f"
         | 
| 864 | 
            +
                @nendo.evalStr( " (integer? 1) " ).should == "#t"
         | 
| 865 | 
            +
                @nendo.evalStr( " (integer? 1.1) " ).should == "#f"
         | 
| 866 | 
            +
                @nendo.evalStr( " (integer? \"str\") " ).should == "#f"
         | 
| 867 | 
            +
                @nendo.evalStr( " (integer? 'a) " ).should == "#f"
         | 
| 868 | 
            +
                @nendo.evalStr( " (integer? '(1)) " ).should == "#f"
         | 
| 869 | 
            +
                @nendo.evalStr( " (integer? '()) " ).should == "#f"
         | 
| 870 | 
            +
                @nendo.evalStr( " (string? car) " ).should == "#f"
         | 
| 871 | 
            +
                @nendo.evalStr( " (string? aFunc) " ).should == "#f"
         | 
| 872 | 
            +
                @nendo.evalStr( " (string? aMacro) " ).should == "#f"
         | 
| 873 | 
            +
                @nendo.evalStr( " (string? 1) " ).should == "#f"
         | 
| 874 | 
            +
                @nendo.evalStr( " (string? 1.1) " ).should == "#f"
         | 
| 875 | 
            +
                @nendo.evalStr( " (string? \"str\") " ).should == "#t"
         | 
| 876 | 
            +
                @nendo.evalStr( " (string? 'a) " ).should == "#f"
         | 
| 877 | 
            +
                @nendo.evalStr( " (string? '(1)) " ).should == "#f"
         | 
| 878 | 
            +
                @nendo.evalStr( " (string? '()) " ).should == "#f"
         | 
| 879 | 
            +
                @nendo.evalStr( " (macro? car) " ).should == "#f"
         | 
| 880 | 
            +
                @nendo.evalStr( " (macro? aFunc) " ).should == "#f"
         | 
| 881 | 
            +
                @nendo.evalStr( " (macro? aMacro) " ).should == "#t"
         | 
| 882 | 
            +
                @nendo.evalStr( " (macro? 1) " ).should == "#f"
         | 
| 883 | 
            +
                @nendo.evalStr( " (macro? 1.1) " ).should == "#f"
         | 
| 884 | 
            +
                @nendo.evalStr( " (macro? \"str\") " ).should == "#f"
         | 
| 885 | 
            +
                @nendo.evalStr( " (macro? 'a) " ).should == "#f"
         | 
| 886 | 
            +
                @nendo.evalStr( " (macro? '(1)) " ).should == "#f"
         | 
| 887 | 
            +
                @nendo.evalStr( " (macro? '()) " ).should == "#f"
         | 
| 888 | 
            +
                @nendo.evalStr( " (length '()) " ).should == "0"
         | 
| 889 | 
            +
                @nendo.evalStr( " (length '(1)) " ).should == "1"
         | 
| 890 | 
            +
                @nendo.evalStr( " (length '((1))) " ).should == "1"
         | 
| 891 | 
            +
                @nendo.evalStr( " (length '(1 2)) " ).should == "2"
         | 
| 892 | 
            +
                lambda { @nendo.evalStr( " (length \"str\") " ) }.should  raise_error(TypeError)
         | 
| 893 | 
            +
                lambda { @nendo.evalStr( " (length 1) " ) }.should  raise_error(TypeError)
         | 
| 894 | 
            +
                @nendo.evalStr( " (symbol->string 'sym) " ).should == '"sym"'
         | 
| 895 | 
            +
                @nendo.evalStr( " (string->symbol \"sym\") " ).should == 'sym'
         | 
| 896 | 
            +
                @nendo.evalStr( ' (string-join \'("Aa" "Bb" "Cc")    ) ' ).should  == '"AaBbCc"'
         | 
| 897 | 
            +
                @nendo.evalStr( ' (string-join \'("Aa" "Bb" "Cc") ":") ' ).should  == '"Aa:Bb:Cc"'
         | 
| 898 | 
            +
                @nendo.evalStr( ' (string-join \'("Aa" "Bb" "Cc") "//") ' ).should == '"Aa//Bb//Cc"'
         | 
| 899 | 
            +
                lambda { @nendo.evalStr( ' (string-join \'("Aa" "Bb" "Cc") 100) ' ) }.should  raise_error(TypeError)
         | 
| 900 | 
            +
                lambda { @nendo.evalStr( ' (string-join \'("Aa" "Bb" "Cc") :xx) ' ) }.should  raise_error(TypeError)
         | 
| 781 901 | 
             
              end
         | 
| 782 902 | 
             
            end
         | 
| 783 903 |  | 
| 784 | 
            -
            describe Nendo, "when call  | 
| 904 | 
            +
            describe Nendo, "when call evalStr() with variable modifications" do
         | 
| 785 905 | 
             
              before do
         | 
| 786 906 | 
             
                @nendo = Nendo::Core.new()
         | 
| 787 907 | 
             
              end
         | 
| 788 908 | 
             
              it "should" do
         | 
| 789 | 
            -
                @nendo. | 
| 790 | 
            -
                @nendo. | 
| 791 | 
            -
                @nendo. | 
| 792 | 
            -
                @nendo. | 
| 793 | 
            -
                @nendo. | 
| 794 | 
            -
                @nendo. | 
| 795 | 
            -
                @nendo. | 
| 796 | 
            -
                @nendo. | 
| 797 | 
            -
                @nendo. | 
| 798 | 
            -
                @nendo. | 
| 799 | 
            -
                @nendo. | 
| 800 | 
            -
                @nendo. | 
| 801 | 
            -
                @nendo. | 
| 802 | 
            -
                @nendo. | 
| 803 | 
            -
                @nendo. | 
| 804 | 
            -
                @nendo. | 
| 805 | 
            -
                @nendo. | 
| 806 | 
            -
                @nendo. | 
| 807 | 
            -
                @nendo. | 
| 808 | 
            -
                @nendo. | 
| 809 | 
            -
                @nendo. | 
| 810 | 
            -
                @nendo. | 
| 811 | 
            -
                @nendo. | 
| 812 | 
            -
                @nendo. | 
| 813 | 
            -
                @nendo. | 
| 814 | 
            -
                @nendo. | 
| 815 | 
            -
                @nendo. | 
| 909 | 
            +
                @nendo.evalStr( " (define x 1)     x " ).should == "1"
         | 
| 910 | 
            +
                @nendo.evalStr( " (define x 2)     x " ).should == "2"
         | 
| 911 | 
            +
                @nendo.evalStr( " (define x 100)   x " ).should == "100"
         | 
| 912 | 
            +
                @nendo.evalStr( " (define x true)  x " ).should == "#t"
         | 
| 913 | 
            +
                @nendo.evalStr( " (define x false) x " ).should == "#f"
         | 
| 914 | 
            +
                @nendo.evalStr( " (define x nil) x " ).should   == "nil"
         | 
| 915 | 
            +
                @nendo.evalStr( " (define x '()) x " ).should   == "()"
         | 
| 916 | 
            +
                @nendo.evalStr( " (define x '(1)) x " ).should   == "(1)"
         | 
| 917 | 
            +
                @nendo.evalStr( " (define x (+ 1 2 3)) x " ).should   == "6"
         | 
| 918 | 
            +
                @nendo.evalStr( " (define x (sprintf \"$%02X\" 17))    x  x  x " ).should   == '"$11"'
         | 
| 919 | 
            +
                @nendo.evalStr( " 1 2 3 " ).should   == "3"
         | 
| 920 | 
            +
                @nendo.evalStr( " (define x 3.14)  (set! x (* x 2))          x " ).should   == "6.28"
         | 
| 921 | 
            +
                @nendo.evalStr( " 1 \n 2 \n 3 \n " ).should   == "3"
         | 
| 922 | 
            +
                @nendo.evalStr( " (define a '(1 . 2))  (set-car! a 100)      a " ).should   == "(100 . 2)"
         | 
| 923 | 
            +
                @nendo.evalStr( " (define a '(1 . 2))  (set-car! a '())      a " ).should   == "(() . 2)"
         | 
| 924 | 
            +
                @nendo.evalStr( " (define a '(1 . 2))  (set-car! a #t)       a " ).should   == "(#t . 2)"
         | 
| 925 | 
            +
                @nendo.evalStr( " (define a '(1 . 2))  (set-car! a #f)       a " ).should   == "(#f . 2)"
         | 
| 926 | 
            +
                @nendo.evalStr( " (define a '(1 . 2))  (set-car! a nil)      a " ).should   == "(nil . 2)"
         | 
| 927 | 
            +
                @nendo.evalStr( " (define a '(1 . 2))  (set-cdr! a 200)      a " ).should   == "(1 . 200)"
         | 
| 928 | 
            +
                @nendo.evalStr( " (define a '(1 . 2))  (set-cdr! a '(2))     a " ).should   == "(1 2)"
         | 
| 929 | 
            +
                @nendo.evalStr( " (define a '(1 . 2))  (set-cdr! a '())      a " ).should   == "(1)"
         | 
| 930 | 
            +
                @nendo.evalStr( " (define a '(1 . 2))  (set-cdr! a #t)       a " ).should   == "(1 . #t)"
         | 
| 931 | 
            +
                @nendo.evalStr( " (define a '(1 . 2))  (set-cdr! a #f)       a " ).should   == "(1 . #f)"
         | 
| 932 | 
            +
                @nendo.evalStr( " (define a '(1 . 2))  (set-cdr! a nil)      a " ).should   == "(1 . nil)"
         | 
| 933 | 
            +
                @nendo.evalStr( " (define a '((1 . 2) 3))    (set-car! (car a) 100)      a " ).should   == "((100 . 2) 3)"
         | 
| 934 | 
            +
                @nendo.evalStr( " (define a '((1 . 2) 3))    (set-cdr! (car a) 200)      a " ).should   == "((1 . 200) 3)"
         | 
| 935 | 
            +
                @nendo.evalStr( " (define a '((1 . 2) . 3))  (set-cdr! a 300)            a " ).should   == "((1 . 2) . 300)"
         | 
| 816 936 | 
             
              end
         | 
| 817 937 | 
             
            end
         | 
| 818 938 |  | 
| 819 | 
            -
            describe Nendo, "when call  | 
| 939 | 
            +
            describe Nendo, "when call evalStr() with undefined variable" do
         | 
| 820 940 | 
             
              before do
         | 
| 821 941 | 
             
                @nendo = Nendo::Core.new()
         | 
| 822 942 | 
             
              end
         | 
| 823 943 | 
             
              it "should" do
         | 
| 824 | 
            -
                lambda { @nendo. | 
| 825 | 
            -
                lambda { @nendo. | 
| 826 | 
            -
                lambda { @nendo. | 
| 827 | 
            -
                lambda { @nendo. | 
| 828 | 
            -
                lambda { @nendo. | 
| 829 | 
            -
                lambda { @nendo. | 
| 830 | 
            -
                lambda { @nendo. | 
| 831 | 
            -
                lambda { @nendo. | 
| 944 | 
            +
                lambda { @nendo.evalStr( " true " ) }.should_not                   raise_error
         | 
| 945 | 
            +
                lambda { @nendo.evalStr( " false " ) }.should_not                  raise_error
         | 
| 946 | 
            +
                lambda { @nendo.evalStr( " nil " ) }.should_not                    raise_error
         | 
| 947 | 
            +
                lambda { @nendo.evalStr( " line1 " ) }.should                      raise_error( NameError )
         | 
| 948 | 
            +
                lambda { @nendo.evalStr( " true \n line2 " ) }.should              raise_error( NameError )
         | 
| 949 | 
            +
                lambda { @nendo.evalStr( " true \n true \n line3 " ) }.should      raise_error( NameError )
         | 
| 950 | 
            +
                lambda { @nendo.evalStr( " (+ 1 x) " ) }.should                    raise_error( NameError )
         | 
| 951 | 
            +
                lambda { @nendo.evalStr( " true \n (+ 1 y) " ) }.should            raise_error( NameError )
         | 
| 832 952 | 
             
              end
         | 
| 833 953 | 
             
            end
         | 
| 834 954 |  | 
| 835 | 
            -
            describe Nendo, "when call  | 
| 955 | 
            +
            describe Nendo, "when call evalStr() with built-in special forms" do
         | 
| 836 956 | 
             
              before do
         | 
| 837 957 | 
             
                @nendo = Nendo::Core.new()
         | 
| 838 958 | 
             
              end
         | 
| 839 959 | 
             
              it "should" do
         | 
| 840 | 
            -
                @nendo. | 
| 841 | 
            -
                @nendo. | 
| 842 | 
            -
                @nendo. | 
| 843 | 
            -
                @nendo. | 
| 844 | 
            -
                @nendo. | 
| 845 | 
            -
                @nendo. | 
| 846 | 
            -
                @nendo. | 
| 847 | 
            -
                @nendo. | 
| 848 | 
            -
                @nendo. | 
| 849 | 
            -
                @nendo. | 
| 850 | 
            -
                @nendo. | 
| 851 | 
            -
                @nendo. | 
| 852 | 
            -
                @nendo. | 
| 853 | 
            -
                @nendo. | 
| 854 | 
            -
                @nendo. | 
| 855 | 
            -
                @nendo. | 
| 856 | 
            -
                @nendo. | 
| 857 | 
            -
                @nendo. | 
| 858 | 
            -
                @nendo. | 
| 859 | 
            -
                @nendo. | 
| 860 | 
            -
                @nendo. | 
| 861 | 
            -
                @nendo. | 
| 862 | 
            -
                @nendo. | 
| 863 | 
            -
                @nendo. | 
| 864 | 
            -
                @nendo. | 
| 865 | 
            -
                @nendo. | 
| 866 | 
            -
                @nendo. | 
| 867 | 
            -
                @nendo. | 
| 868 | 
            -
                @nendo. | 
| 869 | 
            -
                lambda { @nendo. | 
| 960 | 
            +
                @nendo.evalStr( " (begin 1) " ).should == "1"
         | 
| 961 | 
            +
                @nendo.evalStr( " (begin 1 2) " ).should == "2"
         | 
| 962 | 
            +
                @nendo.evalStr( " (begin 1 2 3) " ).should == "3"
         | 
| 963 | 
            +
                @nendo.evalStr( " (set! x 2) (set! y (begin (set! x (* x 2)) (set! x (* x 2)) (set! x (* x 2)) 100))  (+ x y)" ).should == "116"
         | 
| 964 | 
            +
                @nendo.evalStr( " (let ()                 100) " ).should == "100"
         | 
| 965 | 
            +
                @nendo.evalStr( " (let ((a 11))           a) " ).should == "11"
         | 
| 966 | 
            +
                @nendo.evalStr( " (let ((a 11) (b 22))    (+ a b)) " ).should == "33"
         | 
| 967 | 
            +
                @nendo.evalStr( " (let ((a 22)) (let ((b 33))   (+ a b))) " ).should == "55"
         | 
| 968 | 
            +
                @nendo.evalStr( " (let ((a 22)(b 33)) (let ((c 44) (d 55))   (+ a b c d))) " ).should == "154"
         | 
| 969 | 
            +
                @nendo.evalStr( " (let  ((a (let ((b 2))   (+ 100 b))))  a) " ).should == "102"
         | 
| 970 | 
            +
                @nendo.evalStr( " (letrec ()                 100) " ).should == "100"
         | 
| 971 | 
            +
                @nendo.evalStr( " (letrec ((a 11))           a) " ).should == "11"
         | 
| 972 | 
            +
                @nendo.evalStr( " (letrec ((a 11) (b 22))    (+ a b)) " ).should == "33"
         | 
| 973 | 
            +
                @nendo.evalStr( " (letrec ((a 22)) (let ((b 33))   (+ a b))) " ).should == "55"
         | 
| 974 | 
            +
                @nendo.evalStr( " (letrec ((a 22)(b 33)) (let ((c 44) (d 55))   (+ a b c d))) " ).should == "154"
         | 
| 975 | 
            +
                @nendo.evalStr( " (letrec  ((a (let ((b 2))   (+ 100 b))))  a) " ).should == "102"
         | 
| 976 | 
            +
                @nendo.evalStr( " (letrec ( (func1 (lambda (x) 13))             (func2 (lambda (x) (* 2 (func1))))  )     (list (func2) (func1))) " ).should == "(26 13)"
         | 
| 977 | 
            +
                @nendo.evalStr( " (letrec ( (func2 (lambda (x) (* 2 (func1))))  (func1 (lambda (x) 7))              )     (list (func2) (func1))) " ).should == "(14 7)"
         | 
| 978 | 
            +
                @nendo.evalStr( " (if true   't 'f)" ).should == "t"
         | 
| 979 | 
            +
                @nendo.evalStr( " (if true   '(1) '(2))" ).should == "(1)"
         | 
| 980 | 
            +
                @nendo.evalStr( " (if false  't 'f)" ).should == "f"
         | 
| 981 | 
            +
                @nendo.evalStr( " (if false  '(1) '(2))" ).should == "(2)"
         | 
| 982 | 
            +
                @nendo.evalStr( " (set! x 0) (if true  (set! x 1) (set! x 2))   x" ).should == "1"
         | 
| 983 | 
            +
                @nendo.evalStr( " (set! x 0) (if false (set! x 1) (set! x 2))   x" ).should == "2"
         | 
| 984 | 
            +
                @nendo.evalStr( " (set! func (lambda (arg1) arg1))              (list (func 1) (func 2))" ).should == "(1 2)"
         | 
| 985 | 
            +
                @nendo.evalStr( " ((lambda (arg1) arg1)  3)" ).should == "3" 
         | 
| 986 | 
            +
                @nendo.evalStr( " ((lambda (arg1) arg1)  (+ 1 2 3))" ).should == "6" 
         | 
| 987 | 
            +
                @nendo.evalStr( " ((if #t + *) 3 4)" ).should == "7" 
         | 
| 988 | 
            +
                @nendo.evalStr( " ((if #f + *) 3 4)" ).should == "12" 
         | 
| 989 | 
            +
                lambda { @nendo.evalStr( " (error \"My Runtime Error\") " ) }.should            raise_error( RuntimeError )
         | 
| 870 990 | 
             
              end
         | 
| 871 991 | 
             
            end
         | 
| 872 992 |  | 
| 873 | 
            -
            describe Nendo, "when call  | 
| 993 | 
            +
            describe Nendo, "when call evalStr() with global and lexical scope variable" do
         | 
| 874 994 | 
             
              before do
         | 
| 875 995 | 
             
                @nendo = Nendo::Core.new()
         | 
| 876 996 | 
             
              end
         | 
| 877 997 | 
             
              it "should" do
         | 
| 878 | 
            -
                @nendo. | 
| 879 | 
            -
                @nendo. | 
| 880 | 
            -
                @nendo. | 
| 881 | 
            -
                @nendo. | 
| 882 | 
            -
                @nendo. | 
| 883 | 
            -
                @nendo. | 
| 998 | 
            +
                @nendo.evalStr( " (define var 111) " ).should == "111"
         | 
| 999 | 
            +
                @nendo.evalStr( " (let ((var 222)) var) " ).should == "222"
         | 
| 1000 | 
            +
                @nendo.evalStr( " (let ((var 222)) (set! var 333) var) " ).should == "333"
         | 
| 1001 | 
            +
                @nendo.evalStr( " (let ((var 222)) (set! var 333)) var " ).should == "111"
         | 
| 1002 | 
            +
                @nendo.evalStr( " (define global1 \"G\") " ).should == '"G"'
         | 
| 1003 | 
            +
                @nendo.evalStr( " " +
         | 
| 884 1004 | 
             
                                "(let ((local1 \"L\")" +
         | 
| 885 1005 | 
             
                                "      (local2 \"L\"))" +
         | 
| 886 1006 | 
             
                                "  (set! global1 (+ global1 \"lobal1\"))" +
         | 
| @@ -899,24 +1019,24 @@ describe Nendo, "when call replStr() with global and lexical scope variable" do | |
| 899 1019 | 
             
              end
         | 
| 900 1020 | 
             
            end
         | 
| 901 1021 |  | 
| 902 | 
            -
            describe Nendo, "when call  | 
| 1022 | 
            +
            describe Nendo, "when call evalStr() with macroexpand-1 function" do
         | 
| 903 1023 | 
             
              before do
         | 
| 904 1024 | 
             
                @nendo = Nendo::Core.new()
         | 
| 905 1025 | 
             
              end
         | 
| 906 1026 | 
             
              it "should" do
         | 
| 907 | 
            -
                @nendo. | 
| 908 | 
            -
                @nendo. | 
| 909 | 
            -
                @nendo. | 
| 910 | 
            -
                @nendo. | 
| 911 | 
            -
                @nendo. | 
| 1027 | 
            +
                @nendo.evalStr( " (set! twice (macro (x) (list 'begin x x)))           (macroexpand-1 '(twice (+ 1 1))) " ).should == "(begin (+ 1 1) (+ 1 1))"
         | 
| 1028 | 
            +
                @nendo.evalStr( " (set! inc (macro (x) (list 'set! x (list '+ x 1))))  (macroexpand-1 '(inc a)) " ).should == "(set! a (+ a 1))"
         | 
| 1029 | 
            +
                @nendo.evalStr( " (set! a 10) (inc a) " ).should == "11"
         | 
| 1030 | 
            +
                @nendo.evalStr( " (set! a 10) (inc a) (inc a)" ).should == "12"
         | 
| 1031 | 
            +
                @nendo.evalStr( " (macroexpand-1 '(twice (twice (inc a))))" ).should ==
         | 
| 912 1032 | 
             
                  "(begin (twice (inc a)) (twice (inc a)))"
         | 
| 913 | 
            -
                @nendo. | 
| 1033 | 
            +
                @nendo.evalStr( " (macroexpand-1 (macroexpand-1 '(twice (twice (inc a)))))" ).should ==
         | 
| 914 1034 | 
             
                  "(begin (begin (inc a) (inc a)) (begin (inc a) (inc a)))"
         | 
| 915 | 
            -
                @nendo. | 
| 1035 | 
            +
                @nendo.evalStr( " (macroexpand-1 (macroexpand-1 (macroexpand-1 '(twice (twice (inc a))))))" ).should ==
         | 
| 916 1036 | 
             
                  "(begin (begin (set! a (+ a 1)) (set! a (+ a 1))) (begin (inc a) (inc a)))"
         | 
| 917 | 
            -
                @nendo. | 
| 1037 | 
            +
                @nendo.evalStr( " (macroexpand-1 (macroexpand-1 (macroexpand-1 (macroexpand-1 '(twice (twice (inc a)))))))" ).should ==
         | 
| 918 1038 | 
             
                  "(begin (begin (set! a (+ a 1)) (set! a (+ a 1))) (begin (set! a (+ a 1)) (set! a (+ a 1))))"
         | 
| 919 | 
            -
                @nendo. | 
| 1039 | 
            +
                @nendo.evalStr( " (set! a 10) (twice (twice (inc a)))" ).should == "14"
         | 
| 920 1040 | 
             
              end
         | 
| 921 1041 | 
             
            end
         | 
| 922 1042 |  | 
| @@ -927,168 +1047,170 @@ describe Nendo, "when call functions in init.nnd " do | |
| 927 1047 | 
             
                @nendo.loadInitFile  # to self optimizing.  The init.nnd file will be loaded twice, so `map' can be optimized on second loading phase.
         | 
| 928 1048 | 
             
              end
         | 
| 929 1049 | 
             
              it "should" do
         | 
| 930 | 
            -
                @nendo. | 
| 931 | 
            -
                @nendo. | 
| 932 | 
            -
                @nendo. | 
| 933 | 
            -
                @nendo. | 
| 934 | 
            -
                @nendo. | 
| 935 | 
            -
                @nendo. | 
| 936 | 
            -
                @nendo. | 
| 937 | 
            -
                @nendo. | 
| 938 | 
            -
                @nendo. | 
| 939 | 
            -
                @nendo. | 
| 940 | 
            -
                @nendo. | 
| 941 | 
            -
                @nendo. | 
| 942 | 
            -
                @nendo. | 
| 943 | 
            -
                @nendo. | 
| 944 | 
            -
                @nendo. | 
| 945 | 
            -
                @nendo. | 
| 946 | 
            -
                @nendo. | 
| 947 | 
            -
                @nendo. | 
| 948 | 
            -
                @nendo. | 
| 949 | 
            -
                @nendo. | 
| 950 | 
            -
                @nendo. | 
| 951 | 
            -
                @nendo. | 
| 952 | 
            -
                @nendo. | 
| 953 | 
            -
                @nendo. | 
| 954 | 
            -
                @nendo. | 
| 955 | 
            -
                @nendo. | 
| 956 | 
            -
                @nendo. | 
| 957 | 
            -
                @nendo. | 
| 958 | 
            -
                @nendo. | 
| 959 | 
            -
                @nendo. | 
| 960 | 
            -
                @nendo. | 
| 961 | 
            -
                @nendo. | 
| 962 | 
            -
                @nendo. | 
| 963 | 
            -
                @nendo. | 
| 964 | 
            -
                @nendo. | 
| 965 | 
            -
                @nendo. | 
| 966 | 
            -
                @nendo. | 
| 967 | 
            -
                @nendo. | 
| 968 | 
            -
                @nendo. | 
| 969 | 
            -
                @nendo. | 
| 970 | 
            -
                @nendo. | 
| 971 | 
            -
                @nendo. | 
| 972 | 
            -
                @nendo. | 
| 973 | 
            -
                @nendo. | 
| 974 | 
            -
                @nendo. | 
| 975 | 
            -
                @nendo. | 
| 976 | 
            -
                @nendo. | 
| 977 | 
            -
                @nendo. | 
| 978 | 
            -
                @nendo. | 
| 979 | 
            -
                @nendo. | 
| 980 | 
            -
                @nendo. | 
| 981 | 
            -
                @nendo. | 
| 982 | 
            -
                @nendo. | 
| 983 | 
            -
                @nendo. | 
| 984 | 
            -
                @nendo. | 
| 985 | 
            -
                @nendo. | 
| 986 | 
            -
                @nendo. | 
| 987 | 
            -
                @nendo. | 
| 988 | 
            -
                @nendo. | 
| 989 | 
            -
                @nendo. | 
| 990 | 
            -
                @nendo. | 
| 991 | 
            -
                @nendo. | 
| 992 | 
            -
                @nendo. | 
| 993 | 
            -
                @nendo. | 
| 994 | 
            -
                @nendo. | 
| 995 | 
            -
                @nendo. | 
| 996 | 
            -
                @nendo. | 
| 997 | 
            -
                @nendo. | 
| 998 | 
            -
                @nendo. | 
| 999 | 
            -
                @nendo. | 
| 1000 | 
            -
                @nendo. | 
| 1001 | 
            -
                @nendo. | 
| 1002 | 
            -
                @nendo. | 
| 1003 | 
            -
                @nendo. | 
| 1004 | 
            -
                @nendo. | 
| 1005 | 
            -
                @nendo. | 
| 1006 | 
            -
                @nendo. | 
| 1007 | 
            -
                @nendo. | 
| 1008 | 
            -
                @nendo. | 
| 1009 | 
            -
                @nendo. | 
| 1010 | 
            -
                @nendo. | 
| 1011 | 
            -
                @nendo. | 
| 1012 | 
            -
                @nendo. | 
| 1013 | 
            -
                @nendo. | 
| 1014 | 
            -
                @nendo. | 
| 1015 | 
            -
                @nendo. | 
| 1016 | 
            -
                @nendo. | 
| 1017 | 
            -
                @nendo. | 
| 1018 | 
            -
                @nendo. | 
| 1019 | 
            -
                @nendo. | 
| 1020 | 
            -
                @nendo. | 
| 1021 | 
            -
                @nendo. | 
| 1022 | 
            -
                @nendo. | 
| 1023 | 
            -
                @nendo. | 
| 1024 | 
            -
                @nendo. | 
| 1025 | 
            -
                @nendo. | 
| 1026 | 
            -
                @nendo. | 
| 1027 | 
            -
                @nendo. | 
| 1028 | 
            -
                @nendo. | 
| 1029 | 
            -
                @nendo. | 
| 1030 | 
            -
                @nendo. | 
| 1031 | 
            -
                @nendo. | 
| 1032 | 
            -
                @nendo. | 
| 1033 | 
            -
                @nendo. | 
| 1034 | 
            -
                @nendo. | 
| 1035 | 
            -
                @nendo. | 
| 1036 | 
            -
                @nendo. | 
| 1037 | 
            -
                @nendo. | 
| 1038 | 
            -
                @nendo. | 
| 1039 | 
            -
                @nendo. | 
| 1040 | 
            -
                @nendo. | 
| 1041 | 
            -
                @nendo. | 
| 1042 | 
            -
                @nendo. | 
| 1043 | 
            -
                @nendo. | 
| 1044 | 
            -
                @nendo. | 
| 1045 | 
            -
                @nendo. | 
| 1046 | 
            -
                @nendo. | 
| 1047 | 
            -
                @nendo. | 
| 1048 | 
            -
                @nendo. | 
| 1049 | 
            -
                @nendo. | 
| 1050 | 
            -
                @nendo. | 
| 1051 | 
            -
                @nendo. | 
| 1052 | 
            -
                @nendo. | 
| 1053 | 
            -
                @nendo. | 
| 1054 | 
            -
                @nendo. | 
| 1055 | 
            -
                @nendo. | 
| 1056 | 
            -
                @nendo. | 
| 1057 | 
            -
                @nendo. | 
| 1058 | 
            -
                @nendo. | 
| 1059 | 
            -
                @nendo. | 
| 1060 | 
            -
                @nendo. | 
| 1061 | 
            -
                @nendo. | 
| 1062 | 
            -
                @nendo. | 
| 1063 | 
            -
                @nendo. | 
| 1064 | 
            -
                @nendo. | 
| 1065 | 
            -
                @nendo. | 
| 1066 | 
            -
                @nendo. | 
| 1067 | 
            -
                @nendo. | 
| 1068 | 
            -
                @nendo. | 
| 1069 | 
            -
                @nendo. | 
| 1070 | 
            -
                @nendo. | 
| 1071 | 
            -
                @nendo. | 
| 1072 | 
            -
                @nendo. | 
| 1073 | 
            -
                @nendo. | 
| 1074 | 
            -
                @nendo. | 
| 1075 | 
            -
                @nendo. | 
| 1076 | 
            -
                @nendo. | 
| 1077 | 
            -
                @nendo. | 
| 1078 | 
            -
                @nendo. | 
| 1079 | 
            -
                @nendo. | 
| 1080 | 
            -
                @nendo. | 
| 1081 | 
            -
                @nendo. | 
| 1082 | 
            -
                @nendo. | 
| 1083 | 
            -
                @nendo. | 
| 1084 | 
            -
                @nendo. | 
| 1085 | 
            -
                @nendo. | 
| 1086 | 
            -
                @nendo. | 
| 1087 | 
            -
                @nendo. | 
| 1088 | 
            -
                @nendo. | 
| 1089 | 
            -
                @nendo. | 
| 1090 | 
            -
                @nendo. | 
| 1091 | 
            -
                @nendo. | 
| 1050 | 
            +
                @nendo.evalStr( " (cadr '(1 2 3 4)) " ).should == "2"
         | 
| 1051 | 
            +
                @nendo.evalStr( " (caddr '(1 2 3 4)) " ).should == "3"
         | 
| 1052 | 
            +
                @nendo.evalStr( " (cadddr '(1 2 3 4)) " ).should == "4"
         | 
| 1053 | 
            +
                @nendo.evalStr( " (caar '((5 6 7 8))) " ).should == "5"
         | 
| 1054 | 
            +
                @nendo.evalStr( " (cdar '((5 6 7 8))) " ).should == "(6 7 8)"
         | 
| 1055 | 
            +
                @nendo.evalStr( " (cadar '((5 6 7 8))) " ).should == "6"
         | 
| 1056 | 
            +
                @nendo.evalStr( " (cddar '((5 6 7 8))) " ).should == "(7 8)"
         | 
| 1057 | 
            +
                @nendo.evalStr( " (iota 1) " ).should == "(0)"
         | 
| 1058 | 
            +
                @nendo.evalStr( " (iota 3) " ).should == "(0 1 2)"
         | 
| 1059 | 
            +
                @nendo.evalStr( " (append '() '()) " ).should == "()"
         | 
| 1060 | 
            +
                @nendo.evalStr( " (append '(1) '()) " ).should == "(1)"
         | 
| 1061 | 
            +
                @nendo.evalStr( " (append '() '(2)) " ).should == "(2)"
         | 
| 1062 | 
            +
                @nendo.evalStr( " (append '(1) '(2)) " ).should == "(1 2)"
         | 
| 1063 | 
            +
                @nendo.evalStr( " (append '(1 2) '(3 4)) " ).should == "(1 2 3 4)"
         | 
| 1064 | 
            +
                @nendo.evalStr( " (pair? '()) " ).should == "#f"
         | 
| 1065 | 
            +
                @nendo.evalStr( " (pair? '(1)) " ).should == "#t"
         | 
| 1066 | 
            +
                @nendo.evalStr( " (pair? '(1 2)) " ).should == "#t"
         | 
| 1067 | 
            +
                @nendo.evalStr( " (pair? '(1 2 3)) " ).should == "#t"
         | 
| 1068 | 
            +
                @nendo.evalStr( " (pair? '(1 . 2)) " ).should == "#t"
         | 
| 1069 | 
            +
                @nendo.evalStr( " (pair? '(())) " ).should == "#t"
         | 
| 1070 | 
            +
                @nendo.evalStr( " (pair? 1) " ).should == "#f"
         | 
| 1071 | 
            +
                @nendo.evalStr( " (pair? \"str\") " ).should == "#f"
         | 
| 1072 | 
            +
                @nendo.evalStr( " (list? '()) " ).should == "#t"
         | 
| 1073 | 
            +
                @nendo.evalStr( " (list? '(1)) " ).should == "#t"
         | 
| 1074 | 
            +
                @nendo.evalStr( " (list? '(1 2)) " ).should == "#t"
         | 
| 1075 | 
            +
                @nendo.evalStr( " (list? '(1 2 3)) " ).should == "#t"
         | 
| 1076 | 
            +
                @nendo.evalStr( " (list? '(1 . 2)) " ).should == "#f"
         | 
| 1077 | 
            +
                @nendo.evalStr( " (list? '(1 2 . 3)) " ).should == "#f"
         | 
| 1078 | 
            +
                @nendo.evalStr( " (list? '(())) " ).should == "#t"
         | 
| 1079 | 
            +
                @nendo.evalStr( " (list? 1) " ).should == "#f"
         | 
| 1080 | 
            +
                @nendo.evalStr( " (list? \"str\") " ).should == "#f"
         | 
| 1081 | 
            +
                @nendo.evalStr( " (even? 2) " ).should == "#t"
         | 
| 1082 | 
            +
                @nendo.evalStr( " (even? 1) " ).should == "#f"
         | 
| 1083 | 
            +
                @nendo.evalStr( " (even? 0) " ).should == "#t"
         | 
| 1084 | 
            +
                @nendo.evalStr( " (even? -1) " ).should == "#f"
         | 
| 1085 | 
            +
                @nendo.evalStr( " (even? -2) " ).should == "#t"
         | 
| 1086 | 
            +
                @nendo.evalStr( " (odd? 2) " ).should == "#f"
         | 
| 1087 | 
            +
                @nendo.evalStr( " (odd? 1) " ).should == "#t"
         | 
| 1088 | 
            +
                @nendo.evalStr( " (odd? 0) " ).should == "#f"
         | 
| 1089 | 
            +
                @nendo.evalStr( " (odd? -1) " ).should == "#t"
         | 
| 1090 | 
            +
                @nendo.evalStr( " (odd? -2) " ).should == "#f"
         | 
| 1091 | 
            +
                @nendo.evalStr( " (zero? 0) " ).should == "#t"
         | 
| 1092 | 
            +
                @nendo.evalStr( " (zero? #f) " ).should == "#f"
         | 
| 1093 | 
            +
                @nendo.evalStr( " (zero? #t) " ).should == "#f"
         | 
| 1094 | 
            +
                @nendo.evalStr( " (zero? 1) " ).should == "#f"
         | 
| 1095 | 
            +
                @nendo.evalStr( " (zero? 2) " ).should == "#f"
         | 
| 1096 | 
            +
                @nendo.evalStr( " (zero? -1) " ).should == "#f"
         | 
| 1097 | 
            +
                @nendo.evalStr( " (zero? \"str\") " ).should == "#f"
         | 
| 1098 | 
            +
                @nendo.evalStr( " (zero? zero?) " ).should == "#f"
         | 
| 1099 | 
            +
                @nendo.evalStr( " (positive? 1) " ).should == "#t"
         | 
| 1100 | 
            +
                @nendo.evalStr( " (positive? 0) " ).should == "#f"
         | 
| 1101 | 
            +
                @nendo.evalStr( " (positive? -1) " ).should == "#f"
         | 
| 1102 | 
            +
                @nendo.evalStr( " (negative? 1) " ).should == "#f"
         | 
| 1103 | 
            +
                @nendo.evalStr( " (negative? 0) " ).should == "#f"
         | 
| 1104 | 
            +
                @nendo.evalStr( " (negative? -1) " ).should == "#t"
         | 
| 1105 | 
            +
                @nendo.evalStr( " (abs -1) " ).should == "1"
         | 
| 1106 | 
            +
                @nendo.evalStr( " (abs 1) " ).should == "1"
         | 
| 1107 | 
            +
                @nendo.evalStr( " (abs -1000) " ).should == "1000"
         | 
| 1108 | 
            +
                @nendo.evalStr( " (abs 1000) " ).should == "1000"
         | 
| 1109 | 
            +
                @nendo.evalStr( " (max -2 1 0 1 2 3 4 5) " ).should == "5"
         | 
| 1110 | 
            +
                @nendo.evalStr( " (max 5 4 3 2 1 0 -1 -2) " ).should == "5"
         | 
| 1111 | 
            +
                @nendo.evalStr( " (max 1000000000 10 -10000) " ).should == "1000000000"
         | 
| 1112 | 
            +
                @nendo.evalStr( " (min -2 1 0 1 2 3 4 5) " ).should == "-2"
         | 
| 1113 | 
            +
                @nendo.evalStr( " (min 5 4 3 2 1 0 -1 -2) " ).should == "-2"
         | 
| 1114 | 
            +
                @nendo.evalStr( " (min 1000000000 10 -10000) " ).should == "-10000"
         | 
| 1115 | 
            +
                @nendo.evalStr( " (succ -1) " ).should == "0"
         | 
| 1116 | 
            +
                @nendo.evalStr( " (succ 0) " ).should == "1"
         | 
| 1117 | 
            +
                @nendo.evalStr( " (succ 1) " ).should == "2"
         | 
| 1118 | 
            +
                @nendo.evalStr( " (pred -1) " ).should == "-2"
         | 
| 1119 | 
            +
                @nendo.evalStr( " (pred 0) " ).should == "-1"
         | 
| 1120 | 
            +
                @nendo.evalStr( " (pred 1) " ).should == "0"
         | 
| 1121 | 
            +
                @nendo.evalStr( " (pred 2) " ).should == "1"
         | 
| 1122 | 
            +
                @nendo.evalStr( " (min 1000000000 10 -10000) " ).should == "-10000"
         | 
| 1123 | 
            +
                @nendo.evalStr( " (nth 0  '(100 200 300)) " ).should == "100"
         | 
| 1124 | 
            +
                @nendo.evalStr( " (nth 1  '(100 200 300)) " ).should == "200"
         | 
| 1125 | 
            +
                @nendo.evalStr( " (nth 2  '(100 200 300)) " ).should == "300"
         | 
| 1126 | 
            +
                @nendo.evalStr( " (nth 3  '(100 200 300)) " ).should == "()"
         | 
| 1127 | 
            +
                @nendo.evalStr( " (nth -1 '(100 200 300)) " ).should == "()"
         | 
| 1128 | 
            +
                @nendo.evalStr( " (first   '(100 200 300 400 500 600 700 800 900 1000)) " ).should == "100"
         | 
| 1129 | 
            +
                @nendo.evalStr( " (second  '(100 200 300 400 500 600 700 800 900 1000)) " ).should == "200"
         | 
| 1130 | 
            +
                @nendo.evalStr( " (third   '(100 200 300 400 500 600 700 800 900 1000)) " ).should == "300"
         | 
| 1131 | 
            +
                @nendo.evalStr( " (fourth  '(100 200 300 400 500 600 700 800 900 1000)) " ).should == "400"
         | 
| 1132 | 
            +
                @nendo.evalStr( " (fifth   '(100 200 300 400 500 600 700 800 900 1000)) " ).should == "500"
         | 
| 1133 | 
            +
                @nendo.evalStr( " (sixth   '(100 200 300 400 500 600 700 800 900 1000)) " ).should == "600"
         | 
| 1134 | 
            +
                @nendo.evalStr( " (seventh '(100 200 300 400 500 600 700 800 900 1000)) " ).should == "700"
         | 
| 1135 | 
            +
                @nendo.evalStr( " (eighth  '(100 200 300 400 500 600 700 800 900 1000)) " ).should == "800"
         | 
| 1136 | 
            +
                @nendo.evalStr( " (ninth   '(100 200 300 400 500 600 700 800 900 1000)) " ).should == "900"
         | 
| 1137 | 
            +
                @nendo.evalStr( " (tenth   '(100 200 300 400 500 600 700 800 900 1000)) " ).should == "1000"
         | 
| 1138 | 
            +
                @nendo.evalStr( " (first   '()) " ).should == "()"
         | 
| 1139 | 
            +
                @nendo.evalStr( " (tenth   '()) " ).should == "()"
         | 
| 1140 | 
            +
                @nendo.evalStr( " (to-s      10) " ).should == '"10"'
         | 
| 1141 | 
            +
                @nendo.evalStr( " (to_s      10) " ).should == '"10"'
         | 
| 1142 | 
            +
                @nendo.evalStr( " (x->string 10) " ).should == '"10"'
         | 
| 1143 | 
            +
                @nendo.evalStr( " (to-s      2.1) " ).should == '"2.1"'
         | 
| 1144 | 
            +
                @nendo.evalStr( " (to_s      2.1) " ).should == '"2.1"'
         | 
| 1145 | 
            +
                @nendo.evalStr( " (x->string 2.1) " ).should == '"2.1"'
         | 
| 1146 | 
            +
                @nendo.evalStr( " (to_i    \"22\") " ).should == '22'
         | 
| 1147 | 
            +
                @nendo.evalStr( " (to-i    \"22\") " ).should == '22'
         | 
| 1148 | 
            +
                @nendo.evalStr( " (to_i    \"10000\") " ).should == '10000'
         | 
| 1149 | 
            +
                @nendo.evalStr( " (to-i    \"10000\") " ).should == '10000'
         | 
| 1150 | 
            +
                @nendo.evalStr( " (let1 aaa 111 aaa) " ).should == "111"
         | 
| 1151 | 
            +
                @nendo.evalStr( " (let1 aaa (+ 2 3) aaa) " ).should == "5"
         | 
| 1152 | 
            +
                @nendo.evalStr( " (let1 aaa 333 (let1 bbb 444 (+ aaa bbb))) " ).should == "777"
         | 
| 1153 | 
            +
                @nendo.evalStr( " (let1 aaa 333 (let1 bbb 444 (set! bbb 555) (+ aaa bbb))) " ).should == "888"
         | 
| 1154 | 
            +
                @nendo.evalStr( " (let1 v (map (lambda (x) x) '(1 2 3))  v) " ).should == "(1 2 3)"
         | 
| 1155 | 
            +
                @nendo.evalStr( " (let  ((v (map (lambda (x) x) '(1 2 3)))) v) " ).should == "(1 2 3)"
         | 
| 1156 | 
            +
                @nendo.evalStr( " (cond (true  1) (false 2)) " ).should == "1"
         | 
| 1157 | 
            +
                @nendo.evalStr( " (cond (true   ) (false  )) " ).should == "#t"
         | 
| 1158 | 
            +
                @nendo.evalStr( " (cond (false 1) (true  2)) " ).should == "2"
         | 
| 1159 | 
            +
                @nendo.evalStr( " (cond (true  1) (true  2)) " ).should == "1"
         | 
| 1160 | 
            +
                @nendo.evalStr( " (cond (false 1) (false 2)) " ).should == "()"
         | 
| 1161 | 
            +
                @nendo.evalStr( " (cond (false 1) (false 2) (else 3)) " ).should == "3"
         | 
| 1162 | 
            +
                @nendo.evalStr( " (cond ((- 10 9) => (lambda (x) (+ \"<\" (to_s x) \">\"))) (else 2)) " ).should == '"<1>"'
         | 
| 1163 | 
            +
                @nendo.evalStr( " (cond (true  1) ((- 10 8) => (lambda (x) (+ \"<\" (to_s x) \">\"))) (else 3)) " ).should == "1"
         | 
| 1164 | 
            +
                @nendo.evalStr( " (or) " ).should == "#f"
         | 
| 1165 | 
            +
                @nendo.evalStr( " (or true) " ).should == "#t"
         | 
| 1166 | 
            +
                @nendo.evalStr( " (or false) " ).should == "#f"
         | 
| 1167 | 
            +
                @nendo.evalStr( " (or nil) " ).should == "#f"
         | 
| 1168 | 
            +
                @nendo.evalStr( " (or '(1)) " ).should == "(1)"
         | 
| 1169 | 
            +
                @nendo.evalStr( " (or '()) " ).should == "()"
         | 
| 1170 | 
            +
                @nendo.evalStr( " (or true true true) " ).should == "#t"
         | 
| 1171 | 
            +
                @nendo.evalStr( " (or 1 2 3) " ).should == "1"
         | 
| 1172 | 
            +
                @nendo.evalStr( " (or false 2) " ).should == "2"
         | 
| 1173 | 
            +
                @nendo.evalStr( " (or false false 3) " ).should == "3"
         | 
| 1174 | 
            +
                @nendo.evalStr( " (or false '(2) false) " ).should == "(2)"
         | 
| 1175 | 
            +
                @nendo.evalStr( " (and) " ).should == "#t"
         | 
| 1176 | 
            +
                @nendo.evalStr( " (and true) " ).should == "#t"
         | 
| 1177 | 
            +
                @nendo.evalStr( " (and false) " ).should == "#f"
         | 
| 1178 | 
            +
                @nendo.evalStr( " (and nil) " ).should == "nil"
         | 
| 1179 | 
            +
                @nendo.evalStr( " (and '(1)) " ).should == "(1)"
         | 
| 1180 | 
            +
                @nendo.evalStr( " (and '()) " ).should == "()"
         | 
| 1181 | 
            +
                @nendo.evalStr( " (and true true true) " ).should == "#t"
         | 
| 1182 | 
            +
                @nendo.evalStr( " (and 1 2 3) " ).should == "3"
         | 
| 1183 | 
            +
                @nendo.evalStr( " (and false 2) " ).should == "#f"
         | 
| 1184 | 
            +
                @nendo.evalStr( " (and false false 3) " ).should == "#f"
         | 
| 1185 | 
            +
                @nendo.evalStr( " (and true  2) " ).should == "2"
         | 
| 1186 | 
            +
                @nendo.evalStr( " (and true  true  3) " ).should == "3"
         | 
| 1187 | 
            +
                @nendo.evalStr( " (and true  true  3 false) " ).should == "#f"
         | 
| 1188 | 
            +
                @nendo.evalStr( " (and true '(2) true) " ).should == "#t"
         | 
| 1189 | 
            +
                @nendo.evalStr( " (and true true '(2)) " ).should == "(2)"
         | 
| 1190 | 
            +
                @nendo.evalStr( " (and true '(2) false) " ).should == "#f"
         | 
| 1191 | 
            +
                @nendo.evalStr( " (define total 0) (and 1 2       (set! total (+ total 1)) (set! total (+ total 2)) 5)  total" ).should == "3"
         | 
| 1192 | 
            +
                @nendo.evalStr( " (define total 1) (and 1 2 false (set! total (+ total 2)) (set! total (+ total 3)) 5)  total" ).should == "1"
         | 
| 1193 | 
            +
                @nendo.evalStr( " (apply + 100 '()) " ).should == "100"
         | 
| 1194 | 
            +
                @nendo.evalStr( " (apply + '(1 2)) " ).should == "3"
         | 
| 1195 | 
            +
                @nendo.evalStr( " (apply + 1 2 '(3)) " ).should == "6"
         | 
| 1196 | 
            +
                @nendo.evalStr( " (apply + 1 2 '(3 4)) " ).should == "10"
         | 
| 1197 | 
            +
                @nendo.evalStr( " (apply + 1 2 3 '(4)) " ).should == "10"
         | 
| 1198 | 
            +
                @nendo.evalStr( ' (apply + \'("a" "b" "c")) ' ).should == '"abc"'
         | 
| 1199 | 
            +
                @nendo.evalStr( " (range 5) " ).should == "(0 1 2 3 4)"
         | 
| 1200 | 
            +
                @nendo.evalStr( " (range 5 1) " ).should == "(1 2 3 4 5)"
         | 
| 1201 | 
            +
                @nendo.evalStr( " (range 5 2) " ).should == "(2 3 4 5 6)"
         | 
| 1202 | 
            +
                @nendo.evalStr( " (iota  5 2) " ).should == "(2 3 4 5 6)"
         | 
| 1203 | 
            +
                @nendo.evalStr( " (apply + (range 11)) " ).should == "55"
         | 
| 1204 | 
            +
                @nendo.evalStr( " (apply + (map (lambda (x) (+ x 1)) (range 10))) " ).should == "55"
         | 
| 1205 | 
            +
                @nendo.evalStr( " (apply + (append (range 11) '(100))) " ).should == "155"
         | 
| 1206 | 
            +
                @nendo.evalStr( " (map (lambda (x) 1)  '()) " ).should           == "()"
         | 
| 1207 | 
            +
                @nendo.evalStr( " (map (lambda (x) 1) (to-list '#())) " ).should == "()"
         | 
| 1208 | 
            +
                @nendo.evalStr( " (map (lambda (x) (* x 2)) '(1 2 3)) " ).should == "(2 4 6)"
         | 
| 1209 | 
            +
                @nendo.evalStr( " (map (lambda (x) (+ x 1)) '(1 2 3)) " ).should == "(2 3 4)"
         | 
| 1210 | 
            +
                @nendo.evalStr( " (map (lambda (a b)   (+ a b))   '(1 2 3) '(10 20 30)) " ).should == "(11 22 33)"
         | 
| 1211 | 
            +
                @nendo.evalStr( " (map (lambda (a b)   (- b a))   '(1 2 3) '(10 20 30)) " ).should == "(9 18 27)"
         | 
| 1212 | 
            +
                @nendo.evalStr( " (map (lambda (a b c) (+ a b c)) '(1 2 3) '(10 20 30) '(100 200 300)) " ).should == "(111 222 333)"
         | 
| 1213 | 
            +
                @nendo.evalStr( " (define _result"+
         | 
| 1092 1214 | 
             
                                "   (map"+
         | 
| 1093 1215 | 
             
                                "    (lambda (x)"+
         | 
| 1094 1216 | 
             
                                "      (* x 2))"+
         | 
| @@ -1097,32 +1219,35 @@ describe Nendo, "when call functions in init.nnd " do | |
| 1097 1219 | 
             
                                "  (first  _result)"+
         | 
| 1098 1220 | 
             
                                "  (second _result)"+
         | 
| 1099 1221 | 
             
                                "  (last-pair _result))" ).should == "(2 4 (20000))"
         | 
| 1100 | 
            -
                @nendo. | 
| 1101 | 
            -
                @nendo. | 
| 1102 | 
            -
                @nendo. | 
| 1222 | 
            +
                @nendo.evalStr( " (define _lst '())  (for-each (lambda (x) (set! _lst (cons 1 _lst)))            '())  _lst" ).should == "()"
         | 
| 1223 | 
            +
                @nendo.evalStr( " (define _lst '())  (for-each (lambda (x) (set! _lst (cons (* x 2) _lst))) '(1 2 3))  _lst" ).should == "(6 4 2)"
         | 
| 1224 | 
            +
                @nendo.evalStr( " (define _lst '())  (for-each (lambda (x) (set! _lst (cons (+ x 1) _lst))) '(1 2 3))  _lst" ).should == "(4 3 2)"
         | 
| 1225 | 
            +
                @nendo.evalStr( " (define _lst '())  (for-each (lambda (a b) (set! _lst (cons (cons a b) _lst))) '(1 2 3) '(10 20 30))  _lst" ).should ==
         | 
| 1103 1226 | 
             
                  "((3 . 30) (2 . 20) (1 . 10))"
         | 
| 1104 | 
            -
                @nendo. | 
| 1105 | 
            -
                @nendo. | 
| 1106 | 
            -
                @nendo. | 
| 1107 | 
            -
                @nendo. | 
| 1108 | 
            -
                @nendo. | 
| 1109 | 
            -
                @nendo. | 
| 1110 | 
            -
                @nendo. | 
| 1111 | 
            -
                @nendo. | 
| 1112 | 
            -
                @nendo. | 
| 1113 | 
            -
                @nendo. | 
| 1114 | 
            -
                @nendo. | 
| 1115 | 
            -
                @nendo. | 
| 1116 | 
            -
                @nendo. | 
| 1117 | 
            -
                @nendo. | 
| 1118 | 
            -
                @nendo. | 
| 1227 | 
            +
                @nendo.evalStr( " (define _cnt 0) (for-each   (lambda (x) (set! _cnt (+ _cnt 1))) (range 10000)) _cnt" ).should == "10000"
         | 
| 1228 | 
            +
                @nendo.evalStr( " (filter     (lambda (x) x)             '()) " ).should      == "()"
         | 
| 1229 | 
            +
                @nendo.evalStr( " (filter     (lambda (x) (= x 100))     '(1 2 3)) " ).should == "()"
         | 
| 1230 | 
            +
                @nendo.evalStr( " (filter     (lambda (x) (= x 2))       '(1 2 3)) " ).should == "(2)"
         | 
| 1231 | 
            +
                @nendo.evalStr( " (filter     (lambda (x) (not (= x 2))) '(1 2 3)) " ).should == "(1 3)"
         | 
| 1232 | 
            +
                @nendo.evalStr( " (filter     (lambda (x) (if (= x 2) (* x 100) false))   '(1 2 3)) " ).should == "(2)"
         | 
| 1233 | 
            +
                @nendo.evalStr( " (find       (lambda (x) (= x 100))     '(1 2 3)) " ).should == "#f"
         | 
| 1234 | 
            +
                @nendo.evalStr( " (find       (lambda (x) (= x 2))       '(1 2 3)) " ).should == "2"
         | 
| 1235 | 
            +
                @nendo.evalStr( " (find       (lambda (x) (not (= x 2))) '(1 2 3)) " ).should == "1"
         | 
| 1236 | 
            +
                @nendo.evalStr( " (find       (lambda (x) (if (= x 2) (* x 100) false))   '(1 2 3)) " ).should == "2"
         | 
| 1237 | 
            +
                @nendo.evalStr( " (filter-map (lambda (x) x)             '()) " ).should      == "()"
         | 
| 1238 | 
            +
                @nendo.evalStr( " (filter-map (lambda (x) (= x 100))     '(1 2 3)) " ).should == "()"
         | 
| 1239 | 
            +
                @nendo.evalStr( " (filter-map (lambda (x) (= x 2))       '(1 2 3)) " ).should == "(#t)"
         | 
| 1240 | 
            +
                @nendo.evalStr( " (filter-map (lambda (x) (not (= x 2))) '(1 2 3)) " ).should == "(#t #t)"
         | 
| 1241 | 
            +
                @nendo.evalStr( " (filter-map (lambda (x) (if (= x 2) (* x 10) false)) '(1 2 3)) " ).should == "(20)"
         | 
| 1242 | 
            +
                @nendo.evalStr( " (filter-map (lambda (x) (if (not (= x 2)) (* x 10) false)) '(1 2 3)) " ).should == "(10 30)"
         | 
| 1243 | 
            +
                @nendo.evalStr( " " +
         | 
| 1119 1244 | 
             
                                "(let1 result '()" +
         | 
| 1120 1245 | 
             
                                "  (do" +
         | 
| 1121 1246 | 
             
                                "      ((i 0 (+ i 1)))" +
         | 
| 1122 1247 | 
             
                                "      ((< 10 i) #f)" +
         | 
| 1123 1248 | 
             
                                "    (set! result (cons i result)))" +
         | 
| 1124 1249 | 
             
                                "  (reverse result))" ).should == "(0 1 2 3 4 5 6 7 8 9 10)"
         | 
| 1125 | 
            -
                @nendo. | 
| 1250 | 
            +
                @nendo.evalStr( " " +
         | 
| 1126 1251 | 
             
                                "(let1 result '()" +
         | 
| 1127 1252 | 
             
                                "  (do" +
         | 
| 1128 1253 | 
             
                                "      ((i 0 (+ i 3)))" +
         | 
| @@ -1138,57 +1263,57 @@ describe Nendo, "when use values " do | |
| 1138 1263 | 
             
                @nendo.loadInitFile
         | 
| 1139 1264 | 
             
              end
         | 
| 1140 1265 | 
             
              it "should" do
         | 
| 1141 | 
            -
                @nendo. | 
| 1142 | 
            -
                lambda { @nendo. | 
| 1143 | 
            -
                @nendo. | 
| 1144 | 
            -
                @nendo. | 
| 1145 | 
            -
                @nendo. | 
| 1146 | 
            -
                @nendo. | 
| 1147 | 
            -
                @nendo. | 
| 1148 | 
            -
                @nendo. | 
| 1149 | 
            -
                @nendo. | 
| 1150 | 
            -
                @nendo. | 
| 1151 | 
            -
                @nendo. | 
| 1152 | 
            -
                lambda { @nendo. | 
| 1153 | 
            -
                @nendo. | 
| 1154 | 
            -
                @nendo. | 
| 1155 | 
            -
                @nendo. | 
| 1156 | 
            -
                @nendo. | 
| 1266 | 
            +
                @nendo.evalStr( " (values? (make-values '())) " ).should == "#t"
         | 
| 1267 | 
            +
                lambda { @nendo.evalStr( " (make-values '(1))) " ) }.should        raise_error(ArgumentError)
         | 
| 1268 | 
            +
                @nendo.evalStr( " (values? (make-values '(1 2))) " ).should == "#t"
         | 
| 1269 | 
            +
                @nendo.evalStr( " (values? (make-values '(1 2 3))) " ).should == "#t"
         | 
| 1270 | 
            +
                @nendo.evalStr( " (values? (values)) " ).should == "#t"
         | 
| 1271 | 
            +
                @nendo.evalStr( " (values? (values 1)) " ).should == "#f"
         | 
| 1272 | 
            +
                @nendo.evalStr( " (values 1) " ).should == "1"
         | 
| 1273 | 
            +
                @nendo.evalStr( " (values? (values 1 2)) " ).should == "#t"
         | 
| 1274 | 
            +
                @nendo.evalStr( " (values? (values 1 2 3)) " ).should == "#t"
         | 
| 1275 | 
            +
                @nendo.evalStr( " (values? (values '(a) \"b\" '(\"C\"))) " ).should == "#t"
         | 
| 1276 | 
            +
                @nendo.evalStr( " (values-values (values)) " ).should == "()"
         | 
| 1277 | 
            +
                lambda { @nendo.evalStr( " (values-values (values 1)) " ) }.should     raise_error(TypeError)
         | 
| 1278 | 
            +
                @nendo.evalStr( " (values-values (values 1 2)) " ).should == "(1 2)"
         | 
| 1279 | 
            +
                @nendo.evalStr( " (values-values (values 1 2 3)) " ).should == "(1 2 3)"
         | 
| 1280 | 
            +
                @nendo.evalStr( " (values-values (values '(a) \"b\" '(\"C\"))) " ).should == '((a) "b" ("C"))'
         | 
| 1281 | 
            +
                @nendo.evalStr( "" +
         | 
| 1157 1282 | 
             
                                " (call-with-values" +
         | 
| 1158 1283 | 
             
                                "     (lambda () (values 4 5)) " +
         | 
| 1159 1284 | 
             
                                "   (lambda (a b) b))" ).should == "5"
         | 
| 1160 | 
            -
                @nendo. | 
| 1285 | 
            +
                @nendo.evalStr( "" +
         | 
| 1161 1286 | 
             
                                " (call-with-values" +
         | 
| 1162 1287 | 
             
                                "     (lambda () (values 1 2)) " +
         | 
| 1163 1288 | 
             
                                "   cons)" ).should == "(1 . 2)"
         | 
| 1164 | 
            -
                @nendo. | 
| 1289 | 
            +
                @nendo.evalStr( "" +
         | 
| 1165 1290 | 
             
                                " (call-with-values" +
         | 
| 1166 1291 | 
             
                                "     (lambda () (values 10)) " +
         | 
| 1167 1292 | 
             
                                "   list)" ).should == "(10)"
         | 
| 1168 | 
            -
                @nendo. | 
| 1293 | 
            +
                @nendo.evalStr( "" +
         | 
| 1169 1294 | 
             
                                " (call-with-values" +
         | 
| 1170 1295 | 
             
                                "     (lambda () (values)) " +
         | 
| 1171 1296 | 
             
                                "   list)" ).should == "()"
         | 
| 1172 | 
            -
                @nendo. | 
| 1173 | 
            -
                @nendo. | 
| 1174 | 
            -
                @nendo. | 
| 1175 | 
            -
                @nendo. | 
| 1176 | 
            -
                @nendo. | 
| 1177 | 
            -
                @nendo. | 
| 1178 | 
            -
                @nendo. | 
| 1179 | 
            -
                @nendo. | 
| 1180 | 
            -
                @nendo. | 
| 1181 | 
            -
                @nendo. | 
| 1182 | 
            -
                @nendo. | 
| 1183 | 
            -
                @nendo. | 
| 1184 | 
            -
                @nendo. | 
| 1185 | 
            -
                @nendo. | 
| 1186 | 
            -
                @nendo. | 
| 1187 | 
            -
                @nendo. | 
| 1188 | 
            -
                @nendo. | 
| 1189 | 
            -
                @nendo. | 
| 1190 | 
            -
                @nendo. | 
| 1191 | 
            -
                @nendo. | 
| 1297 | 
            +
                @nendo.evalStr( " (call-with-values * -) " ).should == "-1"
         | 
| 1298 | 
            +
                @nendo.evalStr( " (receive (a)       (values)           (list a))       " ).should == "()"
         | 
| 1299 | 
            +
                @nendo.evalStr( " (receive (a)       (values 10)        (list a))       " ).should == "(10)"
         | 
| 1300 | 
            +
                @nendo.evalStr( " (receive (a b)     (values 10 20)     (list a b))     " ).should == "(10 20)"
         | 
| 1301 | 
            +
                @nendo.evalStr( " (receive (a b c)   (values 10 20 30)  (list a b c))   " ).should == "(10 20 30)"
         | 
| 1302 | 
            +
                @nendo.evalStr( " (receive (a . b)   (values 10)        (list a b))     " ).should == "(10 ())"
         | 
| 1303 | 
            +
                @nendo.evalStr( " (receive (a . b)   (values 10 20)     (list a b))     " ).should == "(10 (20))"
         | 
| 1304 | 
            +
                @nendo.evalStr( " (receive (a . b)   (values 10 20 30)  (list a b))     " ).should == "(10 (20 30))"
         | 
| 1305 | 
            +
                @nendo.evalStr( " (receive all       (values)           all)            " ).should == "()"
         | 
| 1306 | 
            +
                @nendo.evalStr( " (receive all       (values 10)        all)            " ).should == "(10)"
         | 
| 1307 | 
            +
                @nendo.evalStr( " (receive all       (values 10 20)     all)            " ).should == "(10 20)"
         | 
| 1308 | 
            +
                @nendo.evalStr( " (receive all       (values 10 20 30)  all)            " ).should == "(10 20 30)"
         | 
| 1309 | 
            +
                @nendo.evalStr( " (receive (a b)     (values '(1) '(2)) (list a b))     " ).should == "((1) (2))"
         | 
| 1310 | 
            +
                @nendo.evalStr( " (receive (a b)     (values '() '(2))  (list a b))     " ).should == "(() (2))"
         | 
| 1311 | 
            +
                @nendo.evalStr( " (receive (a b)     (values '(1) '())  (list a b))     " ).should == "((1) ())"
         | 
| 1312 | 
            +
                @nendo.evalStr( " (receive (a b)     (values #t #t)     (cons a b))     " ).should == "(#t . #t)"
         | 
| 1313 | 
            +
                @nendo.evalStr( " (receive (a b)     (values #t #f)     (cons a b))     " ).should == "(#t . #f)"
         | 
| 1314 | 
            +
                @nendo.evalStr( " (receive (a b)     (values nil #t)    (cons a b))     " ).should == "(nil . #t)"
         | 
| 1315 | 
            +
                @nendo.evalStr( " (receive (a b)     (values nil #f)    (cons a b))     " ).should == "(nil . #f)"
         | 
| 1316 | 
            +
                @nendo.evalStr( " (receive (a b)     (values nil nil)   (cons a b))     " ).should == "(nil . nil)"
         | 
| 1192 1317 | 
             
              end
         | 
| 1193 1318 | 
             
            end
         | 
| 1194 1319 |  | 
| @@ -1198,19 +1323,19 @@ describe Nendo, "when toplevel variable was overwritten " do | |
| 1198 1323 | 
             
                @nendo.loadInitFile
         | 
| 1199 1324 | 
             
              end
         | 
| 1200 1325 | 
             
              it "should" do
         | 
| 1201 | 
            -
                @nendo. | 
| 1202 | 
            -
                lambda { @nendo. | 
| 1203 | 
            -
                @nendo. | 
| 1204 | 
            -
                @nendo. | 
| 1205 | 
            -
                @nendo. | 
| 1206 | 
            -
                @nendo. | 
| 1207 | 
            -
             | 
| 1208 | 
            -
                @nendo. | 
| 1209 | 
            -
                lambda { @nendo. | 
| 1210 | 
            -
                @nendo. | 
| 1211 | 
            -
                @nendo. | 
| 1212 | 
            -
                @nendo. | 
| 1213 | 
            -
                @nendo. | 
| 1326 | 
            +
                @nendo.evalStr( " (define a 1) a" ).should == "1"
         | 
| 1327 | 
            +
                lambda { @nendo.evalStr( " (define (c-func) (+ a b)) (c-func)" ) }.should   raise_error( NameError )
         | 
| 1328 | 
            +
                @nendo.evalStr( " (define b 2) b" ).should == "2"
         | 
| 1329 | 
            +
                @nendo.evalStr( " (c-func) " ).should == "3"
         | 
| 1330 | 
            +
                @nendo.evalStr( " (define b 20) " ).should == "20"
         | 
| 1331 | 
            +
                @nendo.evalStr( " (c-func) " ).should == "21"
         | 
| 1332 | 
            +
             | 
| 1333 | 
            +
                @nendo.evalStr( " (define (a-func) 10) (a-func)" ).should == "10"
         | 
| 1334 | 
            +
                lambda { @nendo.evalStr( " (define (c-func) (* (a-func) (b-func))) (c-func)" ) }.should   raise_error( NameError )
         | 
| 1335 | 
            +
                @nendo.evalStr( " (define (b-func) 20)  (b-func)" ).should == "20"
         | 
| 1336 | 
            +
                @nendo.evalStr( " (c-func) " ).should == "200"
         | 
| 1337 | 
            +
                @nendo.evalStr( " (define (b-func) 200) (b-func)" ).should == "200"
         | 
| 1338 | 
            +
                @nendo.evalStr( " (c-func) " ).should == "2000"
         | 
| 1214 1339 | 
             
              end
         | 
| 1215 1340 | 
             
            end
         | 
| 1216 1341 |  | 
| @@ -1220,18 +1345,18 @@ describe Nendo, "when use quasiquote macro " do | |
| 1220 1345 | 
             
                @nendo.loadInitFile
         | 
| 1221 1346 | 
             
              end
         | 
| 1222 1347 | 
             
              it "should" do
         | 
| 1223 | 
            -
                @nendo. | 
| 1224 | 
            -
                @nendo. | 
| 1225 | 
            -
                @nendo. | 
| 1226 | 
            -
                @nendo. | 
| 1227 | 
            -
                @nendo. | 
| 1228 | 
            -
                @nendo. | 
| 1229 | 
            -
                @nendo. | 
| 1230 | 
            -
                @nendo. | 
| 1231 | 
            -
                @nendo. | 
| 1232 | 
            -
                @nendo. | 
| 1233 | 
            -
                @nendo. | 
| 1234 | 
            -
                @nendo. | 
| 1348 | 
            +
                @nendo.evalStr( " '(a b c) " ).should == "(a b c)"
         | 
| 1349 | 
            +
                @nendo.evalStr( " `(a b c) " ).should == "(a b c)"
         | 
| 1350 | 
            +
                @nendo.evalStr( " `(1 2 3) " ).should == "(1 2 3)"
         | 
| 1351 | 
            +
                @nendo.evalStr( " (set! a 3) `(1 2 ,a) " ).should == "(1 2 3)"
         | 
| 1352 | 
            +
                @nendo.evalStr( " (set! a 3) `(1 2 ,@(list a)) " ).should == "(1 2 3)"
         | 
| 1353 | 
            +
                @nendo.evalStr( " (set! a 3) `(1 ,@(list 2 a)) " ).should == "(1 2 3)"
         | 
| 1354 | 
            +
                @nendo.evalStr( " (set! a 11) `,a " ).should == "11"
         | 
| 1355 | 
            +
                @nendo.evalStr( " (set! a 12) ``,a " ).should == "`,a"
         | 
| 1356 | 
            +
                @nendo.evalStr( " `(list ,(+ 1 2) 4) " ).should == "(list 3 4)"
         | 
| 1357 | 
            +
                @nendo.evalStr( " (let ((name 'a)) `(list ,name ',name)) " ).should == "(list a 'a)"
         | 
| 1358 | 
            +
                @nendo.evalStr( " `(a `(b ,(+ 1 2) ,(foo ,(+ 1 3) d) e) f) " ).should == "(a `(b ,(+ 1 2) ,(foo 4 d) e) f)"
         | 
| 1359 | 
            +
                @nendo.evalStr( " `(( foo ,(- 10 3)) ,@(cdr '(c)) . ,(car '(cons))) " ).should == "((foo 7) . cons)"
         | 
| 1235 1360 | 
             
              end
         | 
| 1236 1361 | 
             
            end
         | 
| 1237 1362 |  | 
| @@ -1241,25 +1366,33 @@ describe Nendo, "when use macros made by quasiquote. " do | |
| 1241 1366 | 
             
                @nendo.loadInitFile
         | 
| 1242 1367 | 
             
              end
         | 
| 1243 1368 | 
             
              it "should" do
         | 
| 1244 | 
            -
                @nendo. | 
| 1245 | 
            -
                @nendo. | 
| 1246 | 
            -
                @nendo. | 
| 1247 | 
            -
                @nendo. | 
| 1248 | 
            -
                @nendo. | 
| 1249 | 
            -
                @nendo. | 
| 1250 | 
            -
                @nendo. | 
| 1251 | 
            -
                @nendo. | 
| 1252 | 
            -
                @nendo. | 
| 1253 | 
            -
                @nendo. | 
| 1254 | 
            -
                @nendo. | 
| 1255 | 
            -
                @nendo. | 
| 1256 | 
            -
                @nendo. | 
| 1369 | 
            +
                @nendo.evalStr( " (case (length '(1      )) ((1) \"one\") ((2) \"two\") (else \"else\")) " ).should == '"one"'
         | 
| 1370 | 
            +
                @nendo.evalStr( " (case (length '(1 2    )) ((1) \"one\") ((2) \"two\") (else \"else\")) " ).should == '"two"'
         | 
| 1371 | 
            +
                @nendo.evalStr( " (case (length '(1 2 3  )) ((1) \"one\") ((2) \"two\") (else \"else\")) " ).should == '"else"'
         | 
| 1372 | 
            +
                @nendo.evalStr( " (case (length '(1 2 3 4)) ((1) \"one\") ((2) \"two\") (else \"else\")) " ).should == '"else"'
         | 
| 1373 | 
            +
                @nendo.evalStr( " (case   100               ((1) \"one\") ((2) \"two\") (else \"else\")) " ).should == '"else"'
         | 
| 1374 | 
            +
                @nendo.evalStr( " (let* ((a 1)   (b (+ a 2)))  (cons a b)) " ).should == "(1 . 3)"
         | 
| 1375 | 
            +
                @nendo.evalStr( " (let* ((a 10)  (b (* a 2)))  (cons a b)) " ).should == "(10 . 20)"
         | 
| 1376 | 
            +
                @nendo.evalStr( " (let* ((a 10)  (b (* a 2)) (c (* b 3)))  (list a b c)) " ).should == "(10 20 60)"
         | 
| 1377 | 
            +
                @nendo.evalStr( " (begin0 1 2 3) " ).should == "1"
         | 
| 1378 | 
            +
                @nendo.evalStr( " (define a 2) (begin0 (set! a (* a 2)) (set! a (* a 2)) (set! a (* a 2)) ) " ).should == "4"
         | 
| 1379 | 
            +
                @nendo.evalStr( " (begin0 100) " ).should == "100"
         | 
| 1380 | 
            +
                @nendo.evalStr( " (begin0) " ).should == "#f"
         | 
| 1381 | 
            +
                @nendo.evalStr( " " +
         | 
| 1257 1382 | 
             
                                "(receive (a b)" +
         | 
| 1258 1383 | 
             
                                "    (begin0" +
         | 
| 1259 1384 | 
             
                                "      (values 1 2)" +
         | 
| 1260 1385 | 
             
                                "      (values 10 20)" +
         | 
| 1261 1386 | 
             
                                "      (values 100 200))" +
         | 
| 1262 1387 | 
             
                                " (cons a b))" ).should == "(1 . 2)"
         | 
| 1388 | 
            +
                @nendo.evalStr( " (macroexpand '(when #t (print \"1\") (print \"2\"))) " ).should == '(if #t (begin (print "1") (print "2")))'
         | 
| 1389 | 
            +
                @nendo.evalStr( " (macroexpand '(unless #t (print \"1\") (print \"2\"))) " ).should == '(if (not #t) (begin (print "1") (print "2")))'
         | 
| 1390 | 
            +
                @nendo.evalStr( " (macroexpand '(if-let1 a #t  (print \"T\")  (print \"F\"))) " ).should == '(let ((a #t)) (if a (print "T") (print "F")))'
         | 
| 1391 | 
            +
                @nendo.evalStr( " (let1 count 0 (when   #t (set! count (+ count 1)) (set! count (+ count 1)))  count) " ).should == "2"
         | 
| 1392 | 
            +
                @nendo.evalStr( " (let1 count 0 (when   #f (set! count (+ count 1)) (set! count (+ count 1)))  count) " ).should == "0"
         | 
| 1393 | 
            +
                @nendo.evalStr( " (let1 count 0 (unless #t (set! count (+ count 1)) (set! count (+ count 1)))  count) " ).should == "0"
         | 
| 1394 | 
            +
                @nendo.evalStr( " (let1 count 0 (unless #f (set! count (+ count 1)) (set! count (+ count 1)))  count) " ).should == "2"
         | 
| 1395 | 
            +
                @nendo.evalStr( " (if-let1 m (rxmatch #/([0-9]+)/ \"abc100abc\") (rxmatch-substring m 1)) " ).should == '"100"'
         | 
| 1263 1396 | 
             
              end
         | 
| 1264 1397 | 
             
            end
         | 
| 1265 1398 |  | 
| @@ -1269,11 +1402,26 @@ describe Nendo, "when use define and lambda macro " do | |
| 1269 1402 | 
             
                @nendo.loadInitFile
         | 
| 1270 1403 | 
             
              end
         | 
| 1271 1404 | 
             
              it "should" do
         | 
| 1272 | 
            -
                @nendo. | 
| 1273 | 
            -
                @nendo. | 
| 1274 | 
            -
                @nendo. | 
| 1275 | 
            -
                @nendo. | 
| 1276 | 
            -
                @nendo. | 
| 1405 | 
            +
                @nendo.evalStr( " (macroexpand '(define (main argv) (newline) 0)) " ).should == "(define main (lambda (argv) (newline) 0))"
         | 
| 1406 | 
            +
                @nendo.evalStr( " (macroexpand '(define (main argv) (define (foo x) x) (+ 10 20) 0 (foo 111))) " ).should == "(define main (lambda (argv) (letrec ((foo (lambda (x) x))) (+ 10 20) 0 (foo 111))))"
         | 
| 1407 | 
            +
                @nendo.evalStr( " (macroexpand '(define (main argv) (define result '()) (define (foo x) x) (define val 0) (define (bar x) (+ val 10)) )) " ).should == "(define main (lambda (argv) (letrec ((result '()) (foo (lambda (x) x)) (val 0) (bar (lambda (x) (+ val 10)))))))"
         | 
| 1408 | 
            +
                @nendo.evalStr( " (define (main argv) (define (foo x) x) (+ 10 20) 0 (foo 111)) (main) " ).should == "111"
         | 
| 1409 | 
            +
                @nendo.evalStr( " (define (main argv) (define (foo1 x) (+ 1 x)) (define (foo2 x) (+ 2 x)) (* (foo1 20) (foo2 30)))   (main '()) " ).should == "672"
         | 
| 1410 | 
            +
                @nendo.evalStr( " (macroexpand '(define (main argv) 0)) " ).should == "(define main (lambda (argv) 0))"
         | 
| 1411 | 
            +
              end
         | 
| 1412 | 
            +
            end
         | 
| 1413 | 
            +
             | 
| 1414 | 
            +
            describe Nendo, "when use macro macro " do
         | 
| 1415 | 
            +
              before do
         | 
| 1416 | 
            +
                @nendo = Nendo::Core.new()
         | 
| 1417 | 
            +
                @nendo.loadInitFile
         | 
| 1418 | 
            +
              end
         | 
| 1419 | 
            +
              it "should" do
         | 
| 1420 | 
            +
                @nendo.evalStr( " (define inc!-macro (macro (x) (+ x 1))) #t" ).should == "#t"
         | 
| 1421 | 
            +
                @nendo.evalStr( " (inc!-macro 10) " ).should == "11"
         | 
| 1422 | 
            +
                @nendo.evalStr( " (define dec!-macro (macro (x) (define (dec! v) (- v 1)) (dec! x)))  #t" ).should == "#t"
         | 
| 1423 | 
            +
                @nendo.evalStr( " (dec!-macro 10) " ).should == "9"
         | 
| 1424 | 
            +
                @nendo.evalStr( " (. (dec!-macro 10) class) " ).should == 'Fixnum'
         | 
| 1277 1425 | 
             
              end
         | 
| 1278 1426 | 
             
            end
         | 
| 1279 1427 |  | 
| @@ -1283,7 +1431,7 @@ describe Nendo, "when use macros expands some syntax. " do | |
| 1283 1431 | 
             
                @nendo.loadInitFile
         | 
| 1284 1432 | 
             
              end
         | 
| 1285 1433 | 
             
              it "should" do
         | 
| 1286 | 
            -
                @nendo. | 
| 1434 | 
            +
                @nendo.evalStr( "" +
         | 
| 1287 1435 | 
             
                                "  (let1 total 0" +
         | 
| 1288 1436 | 
             
                                "    (let loop ((cnt 10))" +
         | 
| 1289 1437 | 
             
                                "      (if (< 0 cnt)" +
         | 
| @@ -1292,14 +1440,14 @@ describe Nendo, "when use macros expands some syntax. " do | |
| 1292 1440 | 
             
                                "            (loop (- cnt 1)))))" +
         | 
| 1293 1441 | 
             
                                "    total)" +
         | 
| 1294 1442 | 
             
                                "" ).should == "55"
         | 
| 1295 | 
            -
                @nendo. | 
| 1443 | 
            +
                @nendo.evalStr( "" +
         | 
| 1296 1444 | 
             
                                "(let label ((a 2)" +
         | 
| 1297 1445 | 
             
                                "            (b 3))" +
         | 
| 1298 1446 | 
             
                                "  (if (<= 9 (+ a b))" +
         | 
| 1299 1447 | 
             
                                "      (* a b)" +
         | 
| 1300 1448 | 
             
                                "      (label 4 5)))" +
         | 
| 1301 1449 | 
             
                                "" ).should == "20"
         | 
| 1302 | 
            -
                @nendo. | 
| 1450 | 
            +
                @nendo.evalStr( "" +
         | 
| 1303 1451 | 
             
                                "(macroexpand '(let loop ((x 1)) "+
         | 
| 1304 1452 | 
             
                                "                 1"+
         | 
| 1305 1453 | 
             
                                "                 2"+
         | 
| @@ -1313,36 +1461,115 @@ describe Nendo, "when use dot-operator (.) macro " do | |
| 1313 1461 | 
             
                @nendo.loadInitFile
         | 
| 1314 1462 | 
             
              end
         | 
| 1315 1463 | 
             
              it "should" do
         | 
| 1316 | 
            -
                @nendo. | 
| 1317 | 
            -
                @nendo. | 
| 1318 | 
            -
                @nendo. | 
| 1319 | 
            -
                lambda { @nendo. | 
| 1320 | 
            -
                lambda { @nendo. | 
| 1321 | 
            -
                @nendo. | 
| 1322 | 
            -
                @nendo. | 
| 1323 | 
            -
                @nendo. | 
| 1324 | 
            -
                lambda { @nendo. | 
| 1325 | 
            -
                @nendo. | 
| 1326 | 
            -
                @nendo. | 
| 1327 | 
            -
                @nendo. | 
| 1328 | 
            -
                @nendo. | 
| 1329 | 
            -
                @nendo. | 
| 1330 | 
            -
                @nendo. | 
| 1331 | 
            -
                @nendo. | 
| 1332 | 
            -
                @nendo. | 
| 1333 | 
            -
                @nendo. | 
| 1334 | 
            -
                @nendo. | 
| 1335 | 
            -
                @nendo. | 
| 1336 | 
            -
                @nendo. | 
| 1337 | 
            -
                @nendo. | 
| 1338 | 
            -
                @nendo. | 
| 1339 | 
            -
                @nendo. | 
| 1340 | 
            -
                @nendo. | 
| 1341 | 
            -
                @nendo. | 
| 1342 | 
            -
                @nendo. | 
| 1343 | 
            -
                @nendo. | 
| 1344 | 
            -
                @nendo. | 
| 1345 | 
            -
                @nendo. | 
| 1464 | 
            +
                @nendo.evalStr( " (macroexpand '(. a b)) " ).should == "(a.b)"
         | 
| 1465 | 
            +
                @nendo.evalStr( " (macroexpand '(. a b c)) " ).should == "(a.b c)"
         | 
| 1466 | 
            +
                @nendo.evalStr( " (macroexpand '(. Kernel open)) " ).should == "(Kernel.open)"
         | 
| 1467 | 
            +
                lambda { @nendo.evalStr( " (macroexpand '(. open)) " ) }.should                   raise_error( ArgumentError )
         | 
| 1468 | 
            +
                lambda { @nendo.evalStr( " (macroexpand '(. open \"aaa\")) " ) }.should           raise_error( TypeError )
         | 
| 1469 | 
            +
                @nendo.evalStr( " (macroexpand '(. a size)) " ).should == "(a.size)"
         | 
| 1470 | 
            +
                @nendo.evalStr( " (macroexpand '(. (. a size) to_s)) " ).gsub( /[12]0[0-9][0-9][0-9]/, "X0000" ).should == "(let ((__gensym__fb4e25e49e9fb4e46342224606faf2e3eabf1251_X0000 (a.size))) (__gensym__fb4e25e49e9fb4e46342224606faf2e3eabf1251_X0000.to_s))"
         | 
| 1471 | 
            +
                @nendo.evalStr( " (macroexpand '(. (. (. a size) to_s) to_i)) " ).gsub( /[12]0[0-9][0-9][0-9]/, "X0000" ).should == "(let ((__gensym__fb4e25e49e9fb4e46342224606faf2e3eabf1251_X0000 (let ((__gensym__fb4e25e49e9fb4e46342224606faf2e3eabf1251_X0000 (a.size))) (__gensym__fb4e25e49e9fb4e46342224606faf2e3eabf1251_X0000.to_s)))) (__gensym__fb4e25e49e9fb4e46342224606faf2e3eabf1251_X0000.to_i))"
         | 
| 1472 | 
            +
                lambda { @nendo.evalStr( " (macroexpand '(. (. a size))) " ) }.should             raise_error( ArgumentError )
         | 
| 1473 | 
            +
                @nendo.evalStr( " (set! str \"str\") str.size " ).should == "3"
         | 
| 1474 | 
            +
                @nendo.evalStr( " (set! str \"str\") (. str size) " ).should == "3"
         | 
| 1475 | 
            +
                @nendo.evalStr( " (set! str \"str\") (+ 1 (. str size)) " ).should == "4"
         | 
| 1476 | 
            +
                @nendo.evalStr( " (set! str \"string\") (. (. str size) to_s) " ).should == '"6"'
         | 
| 1477 | 
            +
                @nendo.evalStr( " (to-s str.size) " ).should == '"6"'
         | 
| 1478 | 
            +
                @nendo.evalStr( " (to-s 'str.size) " ).should == '"str.size"'
         | 
| 1479 | 
            +
                @nendo.evalStr( " (require \"date\") " ).should == "#f"
         | 
| 1480 | 
            +
                @nendo.evalStr( " (. (Date.new 0) strftime \"%x\") " ).should == '"01/01/00"'
         | 
| 1481 | 
            +
                @nendo.evalStr( " (. (Date.new 0) strftime \"%s\") " ).should == '"-62167392000"'
         | 
| 1482 | 
            +
                @nendo.evalStr( " (require \"digest/md5\") " ).should == "#f"
         | 
| 1483 | 
            +
                @nendo.evalStr( " (Digest::MD5.hexdigest \"abc\") " ).should ==           '"900150983cd24fb0d6963f7d28e17f72"'
         | 
| 1484 | 
            +
                @nendo.evalStr( " (Digest::MD5.hexdigest \"source text\") " ).should ==   '"20f79a1416626eeacc0bd9a8db87faa2"'
         | 
| 1485 | 
            +
                @nendo.evalStr( " (define a 1) (a.is_a? Fixnum) " ).should ==     "#t"
         | 
| 1486 | 
            +
                @nendo.evalStr( " (define a 1) (a.is_a? Float) " ).should ==      "#f"
         | 
| 1487 | 
            +
                @nendo.evalStr( " (define a 1) (a.is_a? String) " ).should ==     "#f"
         | 
| 1488 | 
            +
                @nendo.evalStr( " (define a 1.1) (a.is_a? Fixnum) " ).should ==   "#f"
         | 
| 1489 | 
            +
                @nendo.evalStr( " (define a 1.1) (a.is_a? Float) " ).should ==    "#t"
         | 
| 1490 | 
            +
                @nendo.evalStr( " (define a 1.1) (a.is_a? String) " ).should ==   "#f"
         | 
| 1491 | 
            +
                @nendo.evalStr( " (define a \"s\") (a.is_a? Fixnum) " ).should == "#f"
         | 
| 1492 | 
            +
                @nendo.evalStr( " (define a \"s\") (a.is_a? Float) " ).should ==  "#f"
         | 
| 1493 | 
            +
                @nendo.evalStr( " (define a \"s\") (a.is_a? String) " ).should == "#t"
         | 
| 1494 | 
            +
              end
         | 
| 1495 | 
            +
            end
         | 
| 1496 | 
            +
             | 
| 1497 | 
            +
            describe Nendo, "when use dot-operator (.) macro  and  (&block ...) " do
         | 
| 1498 | 
            +
              before do
         | 
| 1499 | 
            +
                @nendo = Nendo::Core.new()
         | 
| 1500 | 
            +
                @nendo.loadInitFile
         | 
| 1501 | 
            +
              end
         | 
| 1502 | 
            +
              it "should" do
         | 
| 1503 | 
            +
                @nendo.evalStr( " (define arr '#(10 50 40 10000 20 30))" ).should                    == "#(10 50 40 10000 20 30)"
         | 
| 1504 | 
            +
                @nendo.evalStr( " (arr.sort)" ).should                                               == "#(10 20 30 40 50 10000)"
         | 
| 1505 | 
            +
                @nendo.evalStr( " (arr.sort (&block (a b)  (if (le? a b)  1  -1))) " ).should        == "#(10000 50 40 30 20 10)"
         | 
| 1506 | 
            +
                @nendo.evalStr( " (arr.sort_by (&block (item)  item.to_s)) " ).should                == "#(10 10000 20 30 40 50)"
         | 
| 1507 | 
            +
              end
         | 
| 1508 | 
            +
            end
         | 
| 1509 | 
            +
             | 
| 1510 | 
            +
            describe Nendo, "when use sort libraries " do
         | 
| 1511 | 
            +
              before do
         | 
| 1512 | 
            +
                @nendo = Nendo::Core.new()
         | 
| 1513 | 
            +
                @nendo.loadInitFile
         | 
| 1514 | 
            +
              end
         | 
| 1515 | 
            +
              it "should" do
         | 
| 1516 | 
            +
                @nendo.evalStr( " (define lst '(1 50 60 30000 4000 200)) " ).should                  == "(1 50 60 30000 4000 200)"
         | 
| 1517 | 
            +
                @nendo.evalStr( " (sort lst) " ).should                                              == "(1 50 60 200 4000 30000)"
         | 
| 1518 | 
            +
                @nendo.evalStr( " (sort '()) " ).should                                              == "()"
         | 
| 1519 | 
            +
                @nendo.evalStr( " (sort lst  (lambda (a b) (- b a))) " ).should                      == "(30000 4000 200 60 50 1)"
         | 
| 1520 | 
            +
                @nendo.evalStr( " (sort-by lst (lambda (item) item)) " ).should                      == "(1 50 60 200 4000 30000)"
         | 
| 1521 | 
            +
                @nendo.evalStr( " (sort-by '() (lambda (item) item)) " ).should                      == "()"
         | 
| 1522 | 
            +
                @nendo.evalStr( " (define lst2 '((1 . \"ddd\") (2 . \"cc\") (3 . \"bbbb\") (4 . \"a\"))) " ).should  == '((1 . "ddd") (2 . "cc") (3 . "bbbb") (4 . "a"))'
         | 
| 1523 | 
            +
                @nendo.evalStr( " (sort lst2 (lambda (a b)  (- (car a) (car b)))) " ).should              == '((1 . "ddd") (2 . "cc") (3 . "bbbb") (4 . "a"))'
         | 
| 1524 | 
            +
                @nendo.evalStr( " (sort lst2 (lambda (a b)  (if (>= (cdr a) (cdr b)) 1 -1))) " ).should   == '((4 . "a") (3 . "bbbb") (2 . "cc") (1 . "ddd"))'
         | 
| 1525 | 
            +
                @nendo.evalStr( " (sort-by lst2 (lambda (item) (car item))) " ).should                    == '((1 . "ddd") (2 . "cc") (3 . "bbbb") (4 . "a"))'
         | 
| 1526 | 
            +
                @nendo.evalStr( " (sort-by lst2 (lambda (item) (cdr item))) " ).should                    == '((4 . "a") (3 . "bbbb") (2 . "cc") (1 . "ddd"))'
         | 
| 1527 | 
            +
                @nendo.evalStr( " (sort-by lst2 (lambda (item) (. (cdr item) size))) " ).should           == '((4 . "a") (2 . "cc") (1 . "ddd") (3 . "bbbb"))'
         | 
| 1528 | 
            +
              end
         | 
| 1529 | 
            +
            end
         | 
| 1530 | 
            +
             | 
| 1531 | 
            +
            describe Nendo, "when use with-open libraries " do
         | 
| 1532 | 
            +
              before do
         | 
| 1533 | 
            +
                @nendo = Nendo::Core.new()
         | 
| 1534 | 
            +
                @nendo.loadInitFile
         | 
| 1535 | 
            +
                @fn = "/tmp/for-with-open.dat"
         | 
| 1536 | 
            +
                open( @fn, "w" ) { |f|
         | 
| 1537 | 
            +
                  f.puts( "line1" )
         | 
| 1538 | 
            +
                  f.puts( "line2" )
         | 
| 1539 | 
            +
                  f.puts( "line3" )
         | 
| 1540 | 
            +
                }
         | 
| 1541 | 
            +
              end
         | 
| 1542 | 
            +
              it "should" do
         | 
| 1543 | 
            +
                @nendo.evalStr( sprintf( " (with-open \"%s\" (lambda (f) (f.readline.chop))) ", @fn )).should                         == '"line1"'
         | 
| 1544 | 
            +
                @nendo.evalStr( sprintf( " (with-open \"%s\" (lambda (f) (f.readline.chop))) ", @fn )).should                         == '"line1"'
         | 
| 1545 | 
            +
                @nendo.evalStr( sprintf( " (with-open \"%s\" (lambda (f) (f.readline.chop) (f.readline.chop))) ", @fn )).should       == '"line2"'
         | 
| 1546 | 
            +
                @nendo.evalStr( sprintf( " (with-open \"%s\" (lambda (f) (f.puts \"Wrote from Nendo.\")) \"w\")  #t", @fn )).should   == "#t"
         | 
| 1547 | 
            +
                @nendo.evalStr( sprintf( " (with-open \"%s\" (lambda (f) (f.readline.chop))) ", @fn )).should                         == '"Wrote from Nendo."'
         | 
| 1548 | 
            +
                lambda { @nendo.evalStr( sprintf( " (with-open \"%s\" (lambda (f) #t) 1 2 ", @fn )) }.should                          raise_error(RuntimeError)
         | 
| 1549 | 
            +
              end
         | 
| 1550 | 
            +
             | 
| 1551 | 
            +
              after do
         | 
| 1552 | 
            +
                File.unlink( @fn )
         | 
| 1553 | 
            +
              end
         | 
| 1554 | 
            +
            end
         | 
| 1555 | 
            +
             | 
| 1556 | 
            +
            describe Nendo, "when use (use ...) macro " do
         | 
| 1557 | 
            +
              before do
         | 
| 1558 | 
            +
                @nendo = Nendo::Core.new()
         | 
| 1559 | 
            +
                @nendo.loadInitFile
         | 
| 1560 | 
            +
              end
         | 
| 1561 | 
            +
              it "should" do
         | 
| 1562 | 
            +
                @nendo.evalStr( " (macroexpand '(use abc)) " ).should            == '(load-library "abc")'
         | 
| 1563 | 
            +
                @nendo.evalStr( " (macroexpand '(use a.b)) " ).should            == '(load-library "a/b")'
         | 
| 1564 | 
            +
                @nendo.evalStr( " (macroexpand '(use a.b.c)) " ).should          == '(load-library "a/b/c")'
         | 
| 1565 | 
            +
                @nendo.evalStr( " (macroexpand '(use a.b.c.d.e.f.g)) " ).should  == '(load-library "a/b/c/d/e/f/g")'
         | 
| 1566 | 
            +
                @nendo.evalStr( " (macroexpand '(use srfi-1)) " ).should         == '(load-library "srfi-1")'
         | 
| 1567 | 
            +
                @nendo.evalStr( " (macroexpand '(use text.tree)) " ).should      == '(load-library "text/tree")'
         | 
| 1568 | 
            +
                @nendo.evalStr( " (macroexpand `(use ,(string->symbol (+ \"text\" \".\" \"tree\")))) " ).should ==  '(load-library "text/tree")'
         | 
| 1569 | 
            +
                lambda { @nendo.evalStr( " (macroexpand '(use '(a)) " ) }.should    raise_error( RuntimeError )
         | 
| 1570 | 
            +
                lambda { @nendo.evalStr( " (macroexpand '(use \"srfi-1\") " ) }.should    raise_error( RuntimeError )
         | 
| 1571 | 
            +
                lambda { @nendo.evalStr( " (macroexpand '(use 1)) " ) }.should    raise_error( RuntimeError )
         | 
| 1572 | 
            +
                lambda { @nendo.evalStr( " (macroexpand '(use (+ 10 20))) " ) }.should    raise_error( RuntimeError )
         | 
| 1346 1573 | 
             
              end
         | 
| 1347 1574 | 
             
            end
         | 
| 1348 1575 |  | 
| @@ -1352,38 +1579,38 @@ describe Nendo, "when use keyword feature " do | |
| 1352 1579 | 
             
                @nendo.loadInitFile
         | 
| 1353 1580 | 
             
              end
         | 
| 1354 1581 | 
             
              it "should" do
         | 
| 1355 | 
            -
                @nendo. | 
| 1356 | 
            -
                @nendo. | 
| 1357 | 
            -
                @nendo. | 
| 1358 | 
            -
                @nendo. | 
| 1359 | 
            -
                @nendo. | 
| 1360 | 
            -
                @nendo. | 
| 1361 | 
            -
                @nendo. | 
| 1362 | 
            -
                @nendo. | 
| 1363 | 
            -
                @nendo. | 
| 1364 | 
            -
                @nendo. | 
| 1365 | 
            -
                @nendo. | 
| 1366 | 
            -
                @nendo. | 
| 1367 | 
            -
                @nendo. | 
| 1368 | 
            -
                @nendo. | 
| 1369 | 
            -
                @nendo. | 
| 1370 | 
            -
                @nendo. | 
| 1371 | 
            -
                @nendo. | 
| 1372 | 
            -
                @nendo. | 
| 1373 | 
            -
                lambda { @nendo. | 
| 1374 | 
            -
                @nendo. | 
| 1375 | 
            -
                @nendo. | 
| 1376 | 
            -
                @nendo. | 
| 1377 | 
            -
                @nendo. | 
| 1378 | 
            -
                @nendo. | 
| 1379 | 
            -
                lambda { @nendo. | 
| 1380 | 
            -
                lambda { @nendo. | 
| 1381 | 
            -
                @nendo. | 
| 1382 | 
            -
                @nendo. | 
| 1383 | 
            -
                lambda { @nendo. | 
| 1384 | 
            -
                lambda { @nendo. | 
| 1385 | 
            -
                lambda { @nendo. | 
| 1386 | 
            -
                @nendo. | 
| 1582 | 
            +
                @nendo.evalStr( " (keyword? :a) " ).should == "#t"
         | 
| 1583 | 
            +
                @nendo.evalStr( ' (keyword? (intern ":a")) ' ).should == "#f"
         | 
| 1584 | 
            +
                @nendo.evalStr( ' (symbol?  (intern ":a")) ' ).should == "#t"
         | 
| 1585 | 
            +
                @nendo.evalStr( " (keyword? ':a) " ).should == "#t"
         | 
| 1586 | 
            +
                @nendo.evalStr( " (symbol? ':a) " ).should == "#f"
         | 
| 1587 | 
            +
                @nendo.evalStr( " (eq?  :a :a) " ).should == "#t"
         | 
| 1588 | 
            +
                @nendo.evalStr( " (eqv? :a :a) " ).should == "#t"
         | 
| 1589 | 
            +
                @nendo.evalStr( ' (eq?  :a (intern ":a")) ' ).should == "#f"
         | 
| 1590 | 
            +
                @nendo.evalStr( ' (eqv? :a (intern ":a")) ' ).should == "#f"
         | 
| 1591 | 
            +
                @nendo.evalStr( ' (keyword? (make-keyword "a")) ' ).should == "#t"
         | 
| 1592 | 
            +
                @nendo.evalStr( " :a " ).should == ":a"
         | 
| 1593 | 
            +
                @nendo.evalStr( " ::a " ).should == "::a"
         | 
| 1594 | 
            +
                @nendo.evalStr( " :::key " ).should == ":::key"
         | 
| 1595 | 
            +
                @nendo.evalStr( ' (make-keyword "a") ' ).should == ":a"
         | 
| 1596 | 
            +
                @nendo.evalStr( ' (make-keyword ":a") ' ).should == "::a"
         | 
| 1597 | 
            +
                @nendo.evalStr( " (make-keyword 'a) " ).should == ":a"
         | 
| 1598 | 
            +
                @nendo.evalStr( " (keyword->string :a) " ).should == '"a"'
         | 
| 1599 | 
            +
                @nendo.evalStr( " (keyword->string :abcde) " ).should == '"abcde"'
         | 
| 1600 | 
            +
                lambda { @nendo.evalStr( " (keyword->string 'a) " ) }.should                  raise_error( TypeError )
         | 
| 1601 | 
            +
                @nendo.evalStr( " : " ).should == ':'
         | 
| 1602 | 
            +
                @nendo.evalStr( " (keyword->string :) " ).should == '""'
         | 
| 1603 | 
            +
                @nendo.evalStr( ' (make-keyword "") ' ).should == ":"
         | 
| 1604 | 
            +
                @nendo.evalStr( " (get-keyword :y '(:x 1 :y 2 :z 3)) " ).should == "2"
         | 
| 1605 | 
            +
                @nendo.evalStr( " (get-keyword 'z '(x 1 y 2 z 3)) " ).should == "3"
         | 
| 1606 | 
            +
                lambda { @nendo.evalStr( " (get-keyword 'z '(x 1 y 2 z)) " ) }.should         raise_error( RuntimeError )
         | 
| 1607 | 
            +
                lambda { @nendo.evalStr( " (get-keyword :t '(:x 1 :y 2 :z 3)) " ) }.should    raise_error( RuntimeError )
         | 
| 1608 | 
            +
                @nendo.evalStr( " (get-keyword :t '() #f) " ).should == "#f"
         | 
| 1609 | 
            +
                @nendo.evalStr( " (get-keyword :t '(:x) #f) " ).should == "#f"
         | 
| 1610 | 
            +
                lambda { @nendo.evalStr( " (get-keyword :t '()) " ) }.should                  raise_error( RuntimeError )
         | 
| 1611 | 
            +
                lambda { @nendo.evalStr( " (get-keyword :t '(:x)) " ) }.should                raise_error( RuntimeError )
         | 
| 1612 | 
            +
                lambda { @nendo.evalStr( " (get-keyword :t 1) " ) }.should                    raise_error( RuntimeError )
         | 
| 1613 | 
            +
                @nendo.evalStr( " (get-keyword :t 1 #f) " ).should == "#f"
         | 
| 1387 1614 | 
             
              end
         | 
| 1388 1615 | 
             
            end
         | 
| 1389 1616 |  | 
| @@ -1393,43 +1620,45 @@ describe Nendo, "when use hash-table feature " do | |
| 1393 1620 | 
             
                @nendo.loadInitFile
         | 
| 1394 1621 | 
             
              end
         | 
| 1395 1622 | 
             
              it "should" do
         | 
| 1396 | 
            -
                @nendo. | 
| 1397 | 
            -
                @nendo. | 
| 1398 | 
            -
                @nendo. | 
| 1399 | 
            -
                @nendo. | 
| 1400 | 
            -
                @nendo. | 
| 1401 | 
            -
                @nendo. | 
| 1402 | 
            -
                @nendo. | 
| 1403 | 
            -
                @nendo. | 
| 1404 | 
            -
                @nendo. | 
| 1405 | 
            -
                @nendo. | 
| 1406 | 
            -
                @nendo. | 
| 1407 | 
            -
                @nendo. | 
| 1408 | 
            -
                @nendo. | 
| 1409 | 
            -
                @nendo. | 
| 1410 | 
            -
                @nendo. | 
| 1411 | 
            -
                @nendo. | 
| 1412 | 
            -
                lambda { @nendo. | 
| 1413 | 
            -
                @nendo. | 
| 1414 | 
            -
                @nendo. | 
| 1415 | 
            -
                @nendo. | 
| 1416 | 
            -
                @nendo. | 
| 1417 | 
            -
                @nendo. | 
| 1418 | 
            -
                @nendo. | 
| 1419 | 
            -
                @nendo. | 
| 1420 | 
            -
                @nendo. | 
| 1421 | 
            -
                @nendo. | 
| 1422 | 
            -
                @nendo. | 
| 1423 | 
            -
                @nendo. | 
| 1424 | 
            -
                @nendo. | 
| 1425 | 
            -
                @nendo. | 
| 1426 | 
            -
                @nendo. | 
| 1427 | 
            -
                @nendo. | 
| 1428 | 
            -
                @nendo. | 
| 1429 | 
            -
                @nendo. | 
| 1430 | 
            -
                @nendo. | 
| 1431 | 
            -
                @nendo. | 
| 1432 | 
            -
                @nendo. | 
| 1623 | 
            +
                @nendo.evalStr( " (define h (make-hash-table)) " ).should == "{}"
         | 
| 1624 | 
            +
                @nendo.evalStr( " (hash-table? 1) " ).should == "#f"
         | 
| 1625 | 
            +
                @nendo.evalStr( " (hash-table? '(1)) " ).should == "#f"
         | 
| 1626 | 
            +
                @nendo.evalStr( " (hash-table? (Array.new)) " ).should == "#f"
         | 
| 1627 | 
            +
                @nendo.evalStr( " (hash-table? (Hash.new)) " ).should == "#t"
         | 
| 1628 | 
            +
                @nendo.evalStr( " h " ).should == "{}"
         | 
| 1629 | 
            +
                @nendo.evalStr( " (hash-table-put! h 'k1 'v1) h" ).should == "{:k1=>:v1}"
         | 
| 1630 | 
            +
                @nendo.evalStr( " (hash-table-put! h 'k2 200) h" ).should == "{:k1=>:v1, :k2=>200}"
         | 
| 1631 | 
            +
                @nendo.evalStr( " (hash-table-get  h 'k1)" ).should == "v1"
         | 
| 1632 | 
            +
                @nendo.evalStr( " (hash-table-get  h 'k2)" ).should == "200"
         | 
| 1633 | 
            +
                @nendo.evalStr( " (hash-table-exist? h 'k1)" ).should == "#t"
         | 
| 1634 | 
            +
                @nendo.evalStr( " (hash-table-exist? h 'k2)" ).should == "#t"
         | 
| 1635 | 
            +
                @nendo.evalStr( " (hash-table-exist? h 'k3)" ).should == "#f"
         | 
| 1636 | 
            +
                @nendo.evalStr( " (hash-table-exist? h \"k1\")" ).should == "#f"
         | 
| 1637 | 
            +
                @nendo.evalStr( " (hash-table-num-entries h)" ).should == "2"
         | 
| 1638 | 
            +
                @nendo.evalStr( " (hash-table-delete! h 'k1)" ).should == "v1"
         | 
| 1639 | 
            +
                lambda { @nendo.evalStr( " (hash-table-get h 'k1)" ) }.should                 raise_error( RuntimeError )
         | 
| 1640 | 
            +
                @nendo.evalStr( " (hash-table-get h 'k1 #f) " ).should == "#f"
         | 
| 1641 | 
            +
                @nendo.evalStr( " (hash-table-num-entries h)" ).should == "1"
         | 
| 1642 | 
            +
                @nendo.evalStr( " (hash-table-clear! h)" ).should == "{}"
         | 
| 1643 | 
            +
                @nendo.evalStr( " (hash-table-num-entries h)" ).should == "0"
         | 
| 1644 | 
            +
                @nendo.evalStr( " (set! h (hash-table '(\"a\" \"AAA\")   '(\"b\" \"BBB\")   '(\"c\" \"CCC\" 100)))  (hash-table-keys   h)" ).should == "(\"a\" \"b\" \"c\")"
         | 
| 1645 | 
            +
                @nendo.evalStr( " (set! h (hash-table '(\"a\" \"AAA\")   '(\"b\" \"BBB\")   '(\"c\" \"CCC\" 100)))  (hash-table-values h)" ).should == "((\"AAA\") (\"BBB\") (\"CCC\" 100))"
         | 
| 1646 | 
            +
                @nendo.evalStr( " (set! h (hash-table '(\"a\" . \"AAA\") '(\"b\" . \"BBB\") '(\"c\" . \"CCC\")))  h" ).should == "{\"a\"=>\"AAA\", \"b\"=>\"BBB\", \"c\"=>\"CCC\"}"
         | 
| 1647 | 
            +
                @nendo.evalStr( " (hash-table-keys       h)" ).should == '("a" "b" "c")'
         | 
| 1648 | 
            +
                @nendo.evalStr( " (hash-table-values     h)" ).should == '("AAA" "BBB" "CCC")'
         | 
| 1649 | 
            +
                @nendo.evalStr( " (hash-table-map        h (lambda (a b) (+ a b)))" ).should == '("aAAA" "bBBB" "cCCC")'
         | 
| 1650 | 
            +
                @nendo.evalStr( " (hash-table-for-each   h (lambda (a b) (+ a b)))" ).should == '("aAAA" "bBBB" "cCCC")'
         | 
| 1651 | 
            +
                @nendo.evalStr( " (set! h (hash-table '(a   AAA) '(b   BBB)))  (hash-table->alist h)" ).should   == "((a AAA) (b BBB))"
         | 
| 1652 | 
            +
                @nendo.evalStr( " (set! h (hash-table '(a . AAA) '(b   BBB)))  (hash-table->alist h)" ).should   == "((a . AAA) (b BBB))"
         | 
| 1653 | 
            +
                @nendo.evalStr( " (set! h (hash-table '(a   AAA) '(b . BBB)))  (hash-table->alist h)" ).should   == "((a AAA) (b . BBB))"
         | 
| 1654 | 
            +
                @nendo.evalStr( " (set! h (hash-table '(a . AAA) '(b . BBB)))  (hash-table->alist h)" ).should   == "((a . AAA) (b . BBB))"
         | 
| 1655 | 
            +
                @nendo.evalStr( " (define alist (hash-table->alist h)) alist" ).should   == "((a . AAA) (b . BBB))"
         | 
| 1656 | 
            +
                @nendo.evalStr( " (define h2 (alist->hash-table alist)) h2" ).should   == "{:a=>:AAA, :b=>:BBB}"
         | 
| 1657 | 
            +
                @nendo.evalStr( " (set! h (make-hash-table)) " ).should == "{}"
         | 
| 1658 | 
            +
                @nendo.evalStr( " (hash-table-push! h 'a :AAA_1)  (hash-table->alist h)" ).should == "((a :AAA_1))"
         | 
| 1659 | 
            +
                @nendo.evalStr( " (hash-table-push! h 'a :AAA_2)  (hash-table->alist h)" ).should == "((a :AAA_2 :AAA_1))"
         | 
| 1660 | 
            +
                @nendo.evalStr( " (hash-table-push! h 'b :BBB_1)  (hash-table->alist h)" ).should == "((a :AAA_2 :AAA_1) (b :BBB_1))"
         | 
| 1661 | 
            +
                @nendo.evalStr( " (hash-table-push! h 'b :BBB_2)  (hash-table->alist h)" ).should == "((a :AAA_2 :AAA_1) (b :BBB_2 :BBB_1))"
         | 
| 1433 1662 | 
             
              end
         | 
| 1434 1663 | 
             
            end
         | 
| 1435 1664 |  | 
| @@ -1439,41 +1668,41 @@ describe Nendo, "when use vector feature " do | |
| 1439 1668 | 
             
                @nendo.loadInitFile
         | 
| 1440 1669 | 
             
              end
         | 
| 1441 1670 | 
             
              it "should" do
         | 
| 1442 | 
            -
                @nendo. | 
| 1443 | 
            -
                @nendo. | 
| 1444 | 
            -
                @nendo. | 
| 1445 | 
            -
                @nendo. | 
| 1446 | 
            -
                @nendo. | 
| 1447 | 
            -
                @nendo. | 
| 1448 | 
            -
                @nendo. | 
| 1449 | 
            -
                @nendo. | 
| 1450 | 
            -
                @nendo. | 
| 1451 | 
            -
                @nendo. | 
| 1452 | 
            -
                @nendo. | 
| 1453 | 
            -
                @nendo. | 
| 1454 | 
            -
                @nendo. | 
| 1455 | 
            -
                @nendo. | 
| 1456 | 
            -
                @nendo. | 
| 1457 | 
            -
                @nendo. | 
| 1458 | 
            -
                @nendo. | 
| 1459 | 
            -
                @nendo. | 
| 1460 | 
            -
                @nendo. | 
| 1461 | 
            -
                @nendo. | 
| 1462 | 
            -
                @nendo. | 
| 1463 | 
            -
                lambda { @nendo. | 
| 1464 | 
            -
                lambda { @nendo. | 
| 1465 | 
            -
                lambda { @nendo. | 
| 1466 | 
            -
                lambda { @nendo. | 
| 1467 | 
            -
                @nendo. | 
| 1468 | 
            -
                @nendo. | 
| 1469 | 
            -
                @nendo. | 
| 1470 | 
            -
                @nendo. | 
| 1471 | 
            -
                @nendo. | 
| 1472 | 
            -
                @nendo. | 
| 1473 | 
            -
                @nendo. | 
| 1474 | 
            -
                @nendo. | 
| 1475 | 
            -
                @nendo. | 
| 1476 | 
            -
                @nendo. | 
| 1671 | 
            +
                @nendo.evalStr( " (define v (vector)) v" ).should == "#()"
         | 
| 1672 | 
            +
                @nendo.evalStr( " (vector? 1) " ).should == "#f"
         | 
| 1673 | 
            +
                @nendo.evalStr( " (vector? (vector)) " ).should == "#t"
         | 
| 1674 | 
            +
                @nendo.evalStr( " (vector? (vector 1)) " ).should == "#t"
         | 
| 1675 | 
            +
                @nendo.evalStr( " (vector? (vector 1 2)) " ).should == "#t"
         | 
| 1676 | 
            +
                @nendo.evalStr( " (vector? '#(1)) " ).should == "#t"
         | 
| 1677 | 
            +
                @nendo.evalStr( " (vector? '#(1 2)) " ).should == "#t"
         | 
| 1678 | 
            +
                @nendo.evalStr( " (vector? (Array.new)) " ).should == "#t"
         | 
| 1679 | 
            +
                @nendo.evalStr( " (vector? (Hash.new)) " ).should == "#f"
         | 
| 1680 | 
            +
                @nendo.evalStr( " (vector? 1.1) " ).should == "#f"
         | 
| 1681 | 
            +
                @nendo.evalStr( " (vector? \"str\") " ).should == "#f"
         | 
| 1682 | 
            +
                @nendo.evalStr( " (define v (make-vector 4))" ).should == "#(nil nil nil nil)"
         | 
| 1683 | 
            +
                @nendo.evalStr( " (vector-set! v 0 'v1)  v" ).should ==   "#(v1 nil nil nil)"
         | 
| 1684 | 
            +
                @nendo.evalStr( " (vector-set! v 1 '100) v" ).should ==  "#(v1 100 nil nil)"
         | 
| 1685 | 
            +
                @nendo.evalStr( " (vector-set! v 2 '200) v" ).should ==    "#(v1 100 200 nil)"
         | 
| 1686 | 
            +
                @nendo.evalStr( " (vector-set! v 3 '(a b c))  v" ).should ==     "#(v1 100 200 (a b c))"
         | 
| 1687 | 
            +
                @nendo.evalStr( " (vector-length v)" ).should == "4"
         | 
| 1688 | 
            +
                @nendo.evalStr( " (vector-ref v 0) " ).should == "v1"
         | 
| 1689 | 
            +
                @nendo.evalStr( " (vector-ref v 1) " ).should == "100"
         | 
| 1690 | 
            +
                @nendo.evalStr( " (vector-ref v 2) " ).should == "200"
         | 
| 1691 | 
            +
                @nendo.evalStr( " (vector-ref v 3) " ).should == "(a b c)"
         | 
| 1692 | 
            +
                lambda { @nendo.evalStr( " (vector-ref v -1)" ) }.should                 raise_error( RuntimeError )
         | 
| 1693 | 
            +
                lambda { @nendo.evalStr( " (vector-ref v -2)" ) }.should                 raise_error( RuntimeError )
         | 
| 1694 | 
            +
                lambda { @nendo.evalStr( " (vector-ref v  5)" ) }.should                 raise_error( RuntimeError )
         | 
| 1695 | 
            +
                lambda { @nendo.evalStr( " (vector-ref v  6)" ) }.should                 raise_error( RuntimeError )
         | 
| 1696 | 
            +
                @nendo.evalStr( " (vector-ref v -1 1000)" ).should == "1000"
         | 
| 1697 | 
            +
                @nendo.evalStr( " (vector-ref v -2 2000)" ).should == "2000"
         | 
| 1698 | 
            +
                @nendo.evalStr( " (vector-ref v  5 3000)" ).should == "3000"
         | 
| 1699 | 
            +
                @nendo.evalStr( " (vector-ref v  6 4000)" ).should == "4000"
         | 
| 1700 | 
            +
                @nendo.evalStr( " (vector-ref v  7 #f)" ).should   == "#f"
         | 
| 1701 | 
            +
                @nendo.evalStr( " (define v   (make-vector 10)) v" ).should == "#(nil nil nil nil nil nil nil nil nil nil)"
         | 
| 1702 | 
            +
                @nendo.evalStr( " (vector->list v)" ).should == "(nil nil nil nil nil nil nil nil nil nil)"
         | 
| 1703 | 
            +
                @nendo.evalStr( " (define lst '(a b c (d)))" ).should == "(a b c (d))"
         | 
| 1704 | 
            +
                @nendo.evalStr( " (list->vector lst)" ).should == "#(a b c (d))"
         | 
| 1705 | 
            +
                @nendo.evalStr( " (list->vector (range 10 1))" ).should == "#(1 2 3 4 5 6 7 8 9 10)"
         | 
| 1477 1706 | 
             
              end
         | 
| 1478 1707 | 
             
            end
         | 
| 1479 1708 |  | 
| @@ -1484,17 +1713,17 @@ describe Nendo, "tail call optimization " do | |
| 1484 1713 | 
             
                @nendo.loadInitFile  # to self optimizing.  The init.nnd file will be loaded twice, so `filter' can be optimized on second loading phase.
         | 
| 1485 1714 | 
             
              end
         | 
| 1486 1715 | 
             
              it "should" do
         | 
| 1487 | 
            -
                @nendo. | 
| 1488 | 
            -
                @nendo. | 
| 1489 | 
            -
                @nendo. | 
| 1490 | 
            -
                @nendo. | 
| 1491 | 
            -
                @nendo. | 
| 1716 | 
            +
                @nendo.evalStr( " (setup-tailcall-mark '(print \"abc\")) " ).should == "(%tailcall (print \"abc\"))"
         | 
| 1717 | 
            +
                @nendo.evalStr( " (setup-tailcall-mark '(begin (print \"abc\") 1 2 3)) " ).should == "(begin (print \"abc\") 1 2 3)"
         | 
| 1718 | 
            +
                @nendo.evalStr( " (setup-tailcall-mark '(begin 1 2 (print \"abc\") 3)) " ).should == "(begin 1 2 (print \"abc\") 3)"
         | 
| 1719 | 
            +
                @nendo.evalStr( " (setup-tailcall-mark '(begin 1 2 3 (print \"abc\"))) " ).should == "(begin 1 2 3 (%tailcall (print \"abc\")))"
         | 
| 1720 | 
            +
                @nendo.evalStr( "" +
         | 
| 1492 1721 | 
             
                                "(setup-tailcall-mark"+
         | 
| 1493 1722 | 
             
                                "  '(lambda '(x)"+
         | 
| 1494 1723 | 
             
                                "    1"+
         | 
| 1495 1724 | 
             
                                "    2"+
         | 
| 1496 1725 | 
             
                                "    (print \"abc\")))" ).should == "(lambda '(x) 1 2 (%tailcall (print \"abc\")))"
         | 
| 1497 | 
            -
                @nendo. | 
| 1726 | 
            +
                @nendo.evalStr( "" +
         | 
| 1498 1727 | 
             
                                "(setup-tailcall-mark"+
         | 
| 1499 1728 | 
             
                                "  '(lambda (x)"+
         | 
| 1500 1729 | 
             
                                "     1"+
         | 
| @@ -1502,31 +1731,31 @@ describe Nendo, "tail call optimization " do | |
| 1502 1731 | 
             
                                "     (if #t"+
         | 
| 1503 1732 | 
             
                                "         (begin 1 2 (print \"abc\"))"+
         | 
| 1504 1733 | 
             
                                "         (begin 1 2 (print \"ABC\")))))" ).should == "(lambda (x) 1 2 (if #t (begin 1 2 (%tailcall (print \"abc\"))) (begin 1 2 (%tailcall (print \"ABC\")))))"
         | 
| 1505 | 
            -
                @nendo. | 
| 1734 | 
            +
                @nendo.evalStr( "(setup-tailcall-mark (macroexpand "+
         | 
| 1506 1735 | 
             
                                "   '(define (foo) (foo))"+
         | 
| 1507 1736 | 
             
                                "  ))" ).should == "(define foo (lambda () (%tailcall (foo))))"
         | 
| 1508 | 
            -
                @nendo. | 
| 1737 | 
            +
                @nendo.evalStr( "(setup-tailcall-mark (macroexpand "+
         | 
| 1509 1738 | 
             
                                "   '(values? (make-values '()))"+
         | 
| 1510 1739 | 
             
                                "  ))" ).should == "(%tailcall (values? (make-values '())))"
         | 
| 1511 | 
            -
                @nendo. | 
| 1740 | 
            +
                @nendo.evalStr( "(setup-tailcall-mark (macroexpand "+
         | 
| 1512 1741 | 
             
                                "   '(cond (false  1) (false  2))"+
         | 
| 1513 1742 | 
             
                                "  ))" ).should == "(if #f (begin 1) (if #f (begin 2) ()))"
         | 
| 1514 | 
            -
                @nendo. | 
| 1743 | 
            +
                @nendo.evalStr( "(setup-tailcall-mark (macroexpand "+
         | 
| 1515 1744 | 
             
                                "   '(cond (false 1) (false 2) (else 3))"+
         | 
| 1516 1745 | 
             
                                "  ))" ).should == "(if #f (begin 1) (if #f (begin 2) (if #t (begin 3) ())))"
         | 
| 1517 | 
            -
                @nendo. | 
| 1746 | 
            +
                @nendo.evalStr( "(setup-tailcall-mark (macroexpand "+
         | 
| 1518 1747 | 
             
                                "   '(and (foo 1) (bar 2))"+
         | 
| 1519 1748 | 
             
                                "  ))" ).should == "(if (not (eq? #f (foo 1))) (%tailcall (bar 2)) #f)"
         | 
| 1520 | 
            -
                @nendo. | 
| 1749 | 
            +
                @nendo.evalStr( "(setup-tailcall-mark (macroexpand "+
         | 
| 1521 1750 | 
             
                                "   '(or (foo 1) (bar 2))"+
         | 
| 1522 | 
            -
                                "  ))" ).gsub( / | 
| 1523 | 
            -
                @nendo. | 
| 1751 | 
            +
                                "  ))" ).gsub( /[24]0[0-9][0-9][0-9]/, "X0000" ).should == "(let ((__gensym__fb4e25e49e9fb4e46342224606faf2e3eabf1251_X0000 (foo 1))) (if __gensym__fb4e25e49e9fb4e46342224606faf2e3eabf1251_X0000 __gensym__fb4e25e49e9fb4e46342224606faf2e3eabf1251_X0000 (let ((__gensym__fb4e25e49e9fb4e46342224606faf2e3eabf1251_X0000 (bar 2))) (if __gensym__fb4e25e49e9fb4e46342224606faf2e3eabf1251_X0000 __gensym__fb4e25e49e9fb4e46342224606faf2e3eabf1251_X0000 #f))))"
         | 
| 1752 | 
            +
                @nendo.evalStr( "(setup-tailcall-mark (macroexpand "+
         | 
| 1524 1753 | 
             
                                "   '(let loop ((x 1))  1 2 (loop 100))"+
         | 
| 1525 1754 | 
             
                                "  ))" ).should == "(letrec ((loop (lambda (x) 1 2 (%tailcall (loop 100))))) (%tailcall (loop 1)))"
         | 
| 1526 | 
            -
                @nendo. | 
| 1755 | 
            +
                @nendo.evalStr( "(setup-tailcall-mark (macroexpand "+
         | 
| 1527 1756 | 
             
                                "   '(let1 aaa 111 aaa)"+
         | 
| 1528 1757 | 
             
                                "  ))" ).should == "(let ((aaa 111)) aaa)"
         | 
| 1529 | 
            -
                @nendo. | 
| 1758 | 
            +
                @nendo.evalStr( "" +
         | 
| 1530 1759 | 
             
                                "(setup-tailcall-mark"+
         | 
| 1531 1760 | 
             
                                "  '(letrec ((func1 "+
         | 
| 1532 1761 | 
             
                                "             (lambda (x)"+
         | 
| @@ -1537,13 +1766,15 @@ describe Nendo, "tail call optimization " do | |
| 1537 1766 | 
             
                                "                2"+
         | 
| 1538 1767 | 
             
                                "                (func1))))"+
         | 
| 1539 1768 | 
             
                                "     (func1 100)))" ).should == "(letrec ((func1 (lambda (x) 1 (%tailcall (func2)))) (func2 (lambda (x) 2 (%tailcall (func1))))) (%tailcall (func1 100)))"
         | 
| 1540 | 
            -
                @nendo. | 
| 1541 | 
            -
                lambda { @nendo. | 
| 1542 | 
            -
                @nendo. | 
| 1543 | 
            -
                @nendo. | 
| 1544 | 
            -
                @nendo. | 
| 1545 | 
            -
                @nendo. | 
| 1546 | 
            -
                @nendo. | 
| 1769 | 
            +
                @nendo.evalStr( "(set-optimize-level 0) " ).should == "0"
         | 
| 1770 | 
            +
                lambda { @nendo.evalStr( "(filter (lambda (x) (< x 10)) (range  10000)) " ) }.should               raise_error(SystemStackError)
         | 
| 1771 | 
            +
                @nendo.evalStr( "(set-optimize-level 1) " ).should == "1"
         | 
| 1772 | 
            +
                @nendo.evalStr( "(apply + (map        (lambda (x) (* x 2))      (range  10000))) " ).should == "99990000"
         | 
| 1773 | 
            +
                @nendo.evalStr( "(filter     (lambda (x) (< x 10))              (range  1000)) " ).should == "(0 1 2 3 4 5 6 7 8 9)"
         | 
| 1774 | 
            +
                @nendo.evalStr( "(filter-map (lambda (x) (when (< x 10) (- x))) (range  1000)) " ).should == "(0 -1 -2 -3 -4 -5 -6 -7 -8 -9)"
         | 
| 1775 | 
            +
                @nendo.evalStr( "(define str (if #t (car '(\"a\")) (car '(\"b\")))) (sprintf \"A%sZ\" str) " ).should == '"AaZ"'
         | 
| 1776 | 
            +
                @nendo.evalStr( "(letrec ((str (if #t (+ \"a\" \"A\") '())))   str.class) " ).should == 'String'
         | 
| 1777 | 
            +
                @nendo.evalStr( "(letrec ((str (if #t (+ \"a\" \"A\") '())))   (+ str \"...\")) " ).should == '"aA..."'
         | 
| 1547 1778 | 
             
              end
         | 
| 1548 1779 | 
             
            end
         | 
| 1549 1780 |  | 
| @@ -1554,13 +1785,82 @@ describe Nendo, "optional argument parser " do | |
| 1554 1785 | 
             
                @nendo.loadInitFile
         | 
| 1555 1786 | 
             
              end
         | 
| 1556 1787 | 
             
              it "should" do
         | 
| 1557 | 
            -
                @nendo. | 
| 1558 | 
            -
                @nendo. | 
| 1559 | 
            -
                @nendo. | 
| 1560 | 
            -
                @nendo. | 
| 1561 | 
            -
                @nendo. | 
| 1562 | 
            -
                @nendo. | 
| 1788 | 
            +
                @nendo.evalStr( " (get-optional '() 100) " ).should == "100"
         | 
| 1789 | 
            +
                @nendo.evalStr( " (get-optional '(1) 100) " ).should == "1"
         | 
| 1790 | 
            +
                @nendo.evalStr( " (get-optional '(2) 100) " ).should == "2"
         | 
| 1791 | 
            +
                @nendo.evalStr( " (get-optional '(3 4) 100) " ).should == "3"
         | 
| 1792 | 
            +
                @nendo.evalStr( " (get-optional '() #t) " ).should == "#t"
         | 
| 1793 | 
            +
                @nendo.evalStr( " (get-optional '() #f) " ).should == "#f"
         | 
| 1794 | 
            +
              end
         | 
| 1795 | 
            +
            end
         | 
| 1796 | 
            +
             | 
| 1797 | 
            +
             | 
| 1798 | 
            +
            describe Nendo, "nendo.test library " do
         | 
| 1799 | 
            +
              before do
         | 
| 1800 | 
            +
                @nendo = Nendo::Core.new()
         | 
| 1801 | 
            +
                @nendo.loadInitFile
         | 
| 1802 | 
            +
              end
         | 
| 1803 | 
            +
              it "should" do
         | 
| 1804 | 
            +
                @nendo.evalStr( " (when (load-library \"nendo/test\") #t) " ).should == "#t"
         | 
| 1805 | 
            +
                @nendo.evalStr( " (when (File.exist? *test-record-file*) (File.unlink *test-record-file*))  #t" ).should == "#t"
         | 
| 1806 | 
            +
                @nendo.evalStr( " (test-output-file (.open \"/dev/null\" \"w\"))  #t" ).should == "#t"
         | 
| 1807 | 
            +
                @nendo.evalStr( " (test-start   \"EMPTY\") " ).should ==                                              '"EMPTY"'
         | 
| 1808 | 
            +
                @nendo.evalStr( " (test-section \"EMPTY-SECTION\") " ).should ==                                      '"EMPTY-SECTION"'
         | 
| 1809 | 
            +
                @nendo.evalStr( " (test-end) " ).should ==                                                            '0'
         | 
| 1810 | 
            +
                @nendo.evalStr( " *test-counts* " ).should ==                                                         '#(0 0 0 0)'
         | 
| 1811 | 
            +
             | 
| 1812 | 
            +
                @nendo.evalStr( " (test-start   \"SUCCESS\") " ).should ==                                            '"SUCCESS"'
         | 
| 1813 | 
            +
                @nendo.evalStr( " (test-section \"SUCCESS-SECTION\") " ).should ==                                    '"SUCCESS-SECTION"'
         | 
| 1814 | 
            +
                @nendo.evalStr( " (test  \"test 1\" 1 (lambda () 1))                  *test-counts*" ).should ==      '#(1 1 0 0)'
         | 
| 1815 | 
            +
                @nendo.evalStr( " (test* \"test 2\" 1 1 eq?)                          *test-counts*" ).should ==      '#(2 2 0 0)'
         | 
| 1816 | 
            +
                @nendo.evalStr( " (test* \"test 3\" (+ 2 2) (* 2 2) eqv?)             *test-counts*" ).should ==      '#(3 3 0 0)'
         | 
| 1817 | 
            +
                @nendo.evalStr( " (test* \"test 4\" \"abc\" (+ \"a\" \"b\" \"c\"))    *test-counts*" ).should ==      '#(4 4 0 0)'
         | 
| 1818 | 
            +
                @nendo.evalStr( " (test* \"test 5\" '(1 . 2)  (cons 1 2))             *test-counts*" ).should ==      '#(5 5 0 0)'
         | 
| 1819 | 
            +
                @nendo.evalStr( " (test-end) " ).should ==                                                            '0'
         | 
| 1820 | 
            +
                @nendo.evalStr( " *test-counts* " ).should ==                                                         '#(5 5 0 0)'
         | 
| 1821 | 
            +
             | 
| 1822 | 
            +
                @nendo.evalStr( " (test-start   \"FAIL\") " ).should ==                                               '"FAIL"'
         | 
| 1823 | 
            +
                @nendo.evalStr( " (test-section \"FAIL-SECTION\") " ).should ==                                       '"FAIL-SECTION"'
         | 
| 1824 | 
            +
                @nendo.evalStr( " (test  \"test 6\" 1 (lambda () 2))                  *test-counts*" ).should ==      '#(6 5 1 0)'
         | 
| 1825 | 
            +
                @nendo.evalStr( " (test* \"test 7\" 1 2 eqv?)                         *test-counts*" ).should ==      '#(7 5 2 0)'
         | 
| 1826 | 
            +
                @nendo.evalStr( " (test* \"test 8\" '(1) '(1) eq?)                    *test-counts*" ).should ==      '#(8 5 3 0)'
         | 
| 1827 | 
            +
                @nendo.evalStr( " (test* \"test 9\" \"ABC\" (+ \"a\" \"b\" \"c\"))    *test-counts*" ).should ==      '#(9 5 4 0)'
         | 
| 1828 | 
            +
                @nendo.evalStr( " (test* \"test 10\" '(1 . 2)  (cons 10 20))          *test-counts*" ).should ==      '#(10 5 5 0)'
         | 
| 1829 | 
            +
                @nendo.evalStr( " (test-end) " ).should ==                                                            '5'
         | 
| 1830 | 
            +
                @nendo.evalStr( " *test-counts* " ).should ==                                                         '#(10 5 5 0)'
         | 
| 1831 | 
            +
             | 
| 1832 | 
            +
                @nendo.evalStr( " (define data #f)   data" ).should ==                                                "#f"
         | 
| 1833 | 
            +
                @nendo.evalStr( " (with-open *test-record-file* (lambda (in) (set! data (in.readline.chomp))))  data " ).should == 
         | 
| 1834 | 
            +
                  '"Total:    10 tests,     5 passed,     5 failed,     0 aborted."'
         | 
| 1563 1835 | 
             
              end
         | 
| 1564 1836 | 
             
            end
         | 
| 1565 1837 |  | 
| 1566 1838 |  | 
| 1839 | 
            +
            describe Nendo, "when use export-to-ruby macro " do
         | 
| 1840 | 
            +
              before do
         | 
| 1841 | 
            +
                @nendo = Nendo::Core.new()
         | 
| 1842 | 
            +
                @nendo.loadInitFile
         | 
| 1843 | 
            +
              end
         | 
| 1844 | 
            +
              it "should" do
         | 
| 1845 | 
            +
                @nendo.evalStr( " (define (nendo_function0  ) 0)  #t" ).should == "#t"
         | 
| 1846 | 
            +
                @nendo.evalStr( " (define (nendo_function1 x) (+ x 1))  #t" ).should == "#t"
         | 
| 1847 | 
            +
                @nendo.evalStr( " (define (nendo_function2 x y) (* x y))  #t" ).should == "#t"
         | 
| 1848 | 
            +
                @nendo.evalStr( " (define (nendo_function7 a b c d e f g) (to-arr (list a b c d e f g)))  #t" ).should == "#t"
         | 
| 1849 | 
            +
                @nendo.evalStr( " (export-to-ruby nendo_function0) " ).should == "#t"
         | 
| 1850 | 
            +
                @nendo.evalStr( " (export-to-ruby nendo_function1) " ).should == "#t"
         | 
| 1851 | 
            +
                @nendo.evalStr( " (export-to-ruby nendo_function2) " ).should == "#t"
         | 
| 1852 | 
            +
                @nendo.evalStr( " (export-to-ruby nendo_function7) " ).should == "#t"
         | 
| 1853 | 
            +
                @nendo.evalStr( " (macroexpand '(export-to-ruby nendo_function1)) " ).should == '(%export-to-ruby "nendo_function1" nendo_function1)'
         | 
| 1854 | 
            +
                @nendo.evalStr( " (macroexpand '(export-to-ruby nendo_function7)) " ).should == '(%export-to-ruby "nendo_function7" nendo_function7)'
         | 
| 1855 | 
            +
                @nendo.evalStr( " (define (a-func0) 0)  #t" ).should == "#t"
         | 
| 1856 | 
            +
                lambda { @nendo.evalStr( " (export-to-ruby a-func0) " ) }.should         raise_error(ArgumentError)
         | 
| 1857 | 
            +
                @nendo.evalStr( " (define (clone) 0)  #t" ).should == "#t"
         | 
| 1858 | 
            +
                lambda { @nendo.evalStr( " (export-to-ruby clone) " ) }.should           raise_error(RuntimeError)
         | 
| 1859 | 
            +
                @nendo.evalStr( " (define variable_a 0)  #t" ).should == "#t"
         | 
| 1860 | 
            +
                lambda { @nendo.evalStr( " (export-to-ruby variable_a) " ) }.should      raise_error(ArgumentError)
         | 
| 1861 | 
            +
                @nendo.nendo_function0.should == 0
         | 
| 1862 | 
            +
                @nendo.nendo_function1( 10 ).should == 11
         | 
| 1863 | 
            +
                @nendo.nendo_function2( 8, 9 ).should == 72
         | 
| 1864 | 
            +
                @nendo.nendo_function7( 7,6,5,4,3,2,1 ).should === [ 7,6,5,4,3,2,1 ]
         | 
| 1865 | 
            +
              end
         | 
| 1866 | 
            +
            end
         |