I'm having trouble using nested break. (The code in question is generated,
so I understand this is nothing like idiomatic Scheme!)
Here's a minimum failing example with Guile 3.0.11:
(let ((i 0) (j 0))
(while #t
(set! i (+ i 1))
(if (eqv? i 5) (break))
(display i)
(display "\n")
(set! j 0)
(while #t
(set! j (+ j 1))
(if (eqv? j 5) (break))
(display j))
(display "\n")))
This is supposed to print
1
1234
2
1234
3
1234
4
1234
But instead I get:
1
1234
2
1234Backtrace:
In ice-9/boot-9.scm:
1752:10 7 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
6 (apply-smob/0 #<thunk 784aa970f300>)
In ice-9/boot-9.scm:
724:2 5 (call-with-prompt ("prompt") #<procedure 784aa971c280 …> …)
In ice-9/eval.scm:
619:8 4 (_ #(#(#<directory (guile-user) 784aa9712c80>)))
In ice-9/boot-9.scm:
2836:4 3 (save-module-excursion #<procedure 784aa9704300 at ice-…>)
4388:12 2 (_)
In /home/rrt/Software/ursa/./loops-for:
10:21 1 (_)
In unknown file:
0 (_ #<procedure abort-to-prompt (_ . _)>)
ERROR: In procedure abort: Abort to unknown prompt
I am not very experienced in Scheme, but my bes understanding of this is
that something has gone wrong with the inner "break".
The source position 10:21 is indeed immediately after "(eqv? j 5)"
As far as I can tell from the Guile manual, this nested use of break should
work fine, so I assume I am doing something basic wrong, but I can't see
what!
--
Web: rrt.sc3d.org