> (define v0 (vector 1 2 3 4 5 6))
> (define cl '()) ; Where we'll save the continuations
> (define v1
> (vector-map (lambda (elt)
> (call/cc
> (lambda (c)
> (set! cl (cons c cl))
> (* elt elt))))
> v0))
> (define v2 v1)
> ((list-ref (reverse cl) 0) 'x)
> (list v0 v1 v2)
This goes into infinite loop? I modified it as:
#!r6rs
(import (rnrs))
(define only-once #t)
(define v0 (vector 1 2 3 4 5 6))
(define cl '())
(define v1
(vector-map (lambda (elt)
(call/cc
(lambda (c)
(set! cl (cons c cl))
(* elt elt))))
v0))
(define v2 v1)
(write v0)(newline)
(write v1)(newline)
(write v2)(newline)
(when only-once
(set! only-once #f)
((car (reverse cl)) 'x))
and I get:
~/var/tmp $ mosh-script proof.sps
#(1 2 3 4 5 6)
#(1 4 9 16 25 36)
#(1 4 9 16 25 36)
#(1 2 3 4 5 6)
#(x 4 9 16 25 36)
#(x 4 9 16 25 36)
~/var/tmp $ petite-script proof.sps
#(1 2 3 4 5 6)
#(1 4 9 16 25 36)
#(1 4 9 16 25 36)
#(1 2 3 4 5 6)
#(1 4 9 16 25 x)
#(1 4 9 16 25 x)
~/var/tmp $ ypsilon-script proof.sps
#(1 2 3 4 5 6)
#(1 4 9 16 25 36)
#(1 4 9 16 25 36)
#(1 2 3 4 5 6)
#(x 4 9 16 25 36)
#(x 4 9 16 25 36)
~/var/tmp $ larceny-script proof.sps
#(1 2 3 4 5 6)
#(1 4 9 16 25 36)
#(1 4 9 16 25 36)
#(1 2 3 4 5 6)
#(x 4 9 16 25 36)
#(x 4 9 16 25 36)
~/var/tmp $ vicare-script proof.sps
#(1 2 3 4 5 6)
#(1 4 9 16 25 36)
#(1 4 9 16 25 36)
#(1 2 3 4 5 6)
#(x 4 9 16 25 36)
#(x 4 9 16 25 36)
~/var/tmp $ plt-r6rs proof.sps
#(1 2 3 4 5 6)
#(1 4 9 16 25 36)
#(1 4 9 16 25 36)
define-values: cannot re-define a constant: v1 in module: "/home/marco/var/tmp/proof.sps"
~/var/tmp $ guile proof.sps
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /home/marco/var/tmp/proof.sps
;;; compiled /home/marco/.cache/guile/ccache/2.0-LE-4-2.0/home/marco/var/tmp/proof.sps.go
#(1 2 3 4 5 6)
#(1 4 9 16 25 36)
#(1 4 9 16 25 36)
#(1 2 3 4 5 6)
#(x 4 9 16 25 36)
#(x 4 9 16 25 36)
I see X's everywhere.
--
Marco Maggi
Sorry, ignore the script in my other message. It should be
the following:
#!r6rs
(import (rnrs))
(let ((only-once #t)
(v0 (vector 1 2 3 4 5 6))
(cl '())
(old-v1 #f))
(let ((v1 (vector-map (lambda (elt)
(call/cc
(lambda (c)
(set! cl (cons c cl))
(* elt elt))))
v0)))
(when only-once
(set! only-once #f)
(set! old-v1 v1)
((car (reverse cl)) 'x))
(write v0)(newline)
(write old-v1)(newline)
(write v1)(newline)))
which yields the following results:
~/var/tmp $ petite-script proof.sps
#(1 2 3 4 5 6)
#(1 4 9 16 25 36)
#(1 4 9 16 25 x)
~/var/tmp $ vicare-script proof.sps
#(1 2 3 4 5 6)
#(1 4 9 16 25 36)
#(x 4 9 16 25 36)
~/var/tmp $ ypsilon-script proof.sps
#(1 2 3 4 5 6)
#(1 4 9 16 25 36)
#(x 4 9 16 25 36)
~/var/tmp $ plt-r6rs proof.sps
#(1 2 3 4 5 6)
#(1 4 9 16 25 36)
#(x 4 9 16 25 36)
~/var/tmp $ guile proof.sps
;;; note: source file /home/marco/var/tmp/proof.sps
;;; newer than compiled /home/marco/.cache/guile/ccache/2.0-LE-4-2.0/home/marco/var/tmp/proof.sps.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /home/marco/var/tmp/proof.sps
;;; compiled /home/marco/.cache/guile/ccache/2.0-LE-4-2.0/home/marco/var/tmp/proof.sps.go
#(1 2 3 4 5 6)
#(1 4 9 16 25 36)
#(x 4 9 16 25 36)
~/var/tmp $ mosh-script proof.sps
#(1 2 3 4 5 6)
#(x 4 9 16 25 36)
#(x 4 9 16 25 36)
so, yes Mosh is the only failing one.
--
Marco Maggi
Thanks Ed.
I didn't realize this.
Fixed and added test.
https://github.com/higepon/mosh/commit/80664a98bd1cf9e699b691f92d270ebaa9b9e83b
Thanks Marco Maggi, I've added your test too.
Cheers.
--- --
Taro Minowa(Higepon)
http://www.monaos.org/
http://code.google.com/p/mosh-scheme/
http://twitter.com/higepon
> --
> You received this message because you are subscribed to the Google Groups "Mosh Developer Disscus" group.
> To post to this group, send email to mosh-develo...@googlegroups.com.
> To unsubscribe from this group, send email to mosh-developer-di...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mosh-developer-discuss?hl=en.
>
>