david135 / ypsilon

Automatically exported from code.google.com/p/ypsilon
Other
0 stars 0 forks source link

Bug involving mutation with `set!' #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The following procedure returns always 0 as first value; it works
correctly in Ikarus, PLT and IronScheme, and I can't see any
order-of-evaluation bugs in it, so I guess it's a bug in Ypsilon:

(define (make-tree depth)
  (let ((count 0))
    (define (mk-tree depth)
      (set! count (+ count 1))
      (if (> depth 1)
          (list (mk-tree (- depth 1))
                (mk-tree (- depth 1)))
          (list)))
    (let ((tree (mk-tree depth)))
      (values count tree))))

I've tested with Ypsilon SVN r468.

Original issue reported on code.google.com by rott...@gmail.com on 22 May 2009 at 9:49

GoogleCodeExporter commented 9 years ago
Than you for your bug report!
-- fujita

Original comment by y.fujita...@gmail.com on 23 May 2009 at 4:17

GoogleCodeExporter commented 9 years ago
I found a bug in the optimizer, and fixed it.
The trunk directory is updated to revision 476.
Please try. Thank you!
-- fujita

$ ypsilon
Ypsilon 0.9.6-trunk/r476 Copyright (c) 2009 Y.Fujita, LittleWing Company 
Limited.
> (define (make-tree depth)
    (let ((count 0))
      (define (mk-tree depth)
        (set! count (+ count 1))
        (if (> depth 1)
            (list (mk-tree (- depth 1))
                  (mk-tree (- depth 1)))
            (list)))
      (let ((tree (mk-tree depth)))
        (values count tree))))
> (make-tree 2)
#<values 3 (() ())
>

Original comment by y.fujita...@gmail.com on 24 May 2009 at 8:55