| To: | scsh-users@scsh.net |
|---|---|
| Subject: | Re: `break' to jump out of a loop ? |
| From: | "Rick Hanson" <rick@tamos.net> |
| Date: | Thu, 9 Jun 2005 16:20:34 -0400 (EDT) |
| Importance: | Normal |
| List-id: | <scsh-users.list-id.scsh.net> |
| Reply-to: | rick@tamos.net |
> Hi, there,
>
> Is there a `break' thing to jump out of a loop, such as in an awk macro?
>
> --
> William
>
>
I think the "standard way" is to use call/cc (although I'm not an expert).
Excuse my old version of scsh:
$ cat > test1.scsh
(define call/cc call-with-current-continuation)
(define (test1)
(let loop0 ((x 1))
(call/cc
(lambda (k)
(let loop1 ((y x))
(if (= y 5)
(k y)
(loop1 (+ y 1))))))))
^D
$ scsh
Welcome to scsh 0.6.4 (Olin Shivers)
Type ,? for help.
> (load "test1.scsh")
test1.scsh
> call/cc
'#{Procedure 1322 (call-with-current-continuation in wind)}
> (test1)
5
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | `break' to jump out of a loop ?, william_xuuu |
|---|---|
| Next by Date: | Re: `break' to jump out of a loop ?, Rick Hanson |
| Previous by Thread: | `break' to jump out of a loop ?, william_xuuu |
| Next by Thread: | Re: `break' to jump out of a loop ?, Michael Sperber |
| Indexes: | [Date] [Thread] [Top] [All Lists] |