Re: [racket-dev] for loops with interleaved escape continuations

2014-07-02 Thread Matthias Felleisen
Interestingly enough, I tried to explain this idea to the Imperative Advanced Placement crowd in the 1990s. With functional programming -- control from tail-recursive functions -- is more expressive than programming with limited loops because you can (1) break/resume/continue/foobar your

Re: [racket-dev] for loops with interleaved escape continuations

2014-07-02 Thread Neil Van Dyke
Loop syntax and sugar is fine. And having #:continue and #:break keywords at the top of the form is sufficient warning of surprises ahead, IMHO. I do have a minor ongoing concern that people coming from other languages lately latch onto the for family of forms from the start, don't get

Re: [racket-dev] for loops with interleaved escape continuations

2014-07-02 Thread Matthias Felleisen
On Jul 2, 2014, at 2:26 PM, Neil Van Dyke wrote: Loop syntax and sugar is fine. And having #:continue and #:break keywords at the top of the form is sufficient warning of surprises ahead, IMHO. I do have a minor ongoing concern that people coming from other languages lately latch onto

Re: [racket-dev] for loops with interleaved escape continuations

2014-07-01 Thread Sam Tobin-Hochstadt
I think this is a good idea, and something that I've wanted for a long time. But there are ways to make it much better, and generalize to all loops. First, recognize that a `for/...` loop is really a recursive function, which is passing along a bunch of arguments. In this setting, `continue`

Re: [racket-dev] for loops with interleaved escape continuations

2014-07-01 Thread Neil Van Dyke
If adding breakcontinue features to your fancy iteration syntax, I propose that any uses of these features in source code be somehow very prominent. For example, perhaps there is a keyword that must be at the top of the fancy iteration form, something like

Re: [racket-dev] for loops with interleaved escape continuations

2014-07-01 Thread Sam Tobin-Hochstadt
I disagree strongly that this is un-rackety. Consider the following loop: (define v ) (let loop ([i 100]) (define e (vector-ref v i)) (cond [(zero? i) null] [(= 999 e) null] [(even? e) (loop (add1 i))] [else (cons e (loop add1 i))])) I don't think that's

Re: [racket-dev] for loops with interleaved escape continuations

2014-07-01 Thread John Clements
On Jul 1, 2014, at 3:46 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I disagree strongly that this is un-rackety. Consider the following loop: (define v ) (let loop ([i 100]) (define e (vector-ref v i)) (cond [(zero? i) null] [(= 999 e) null] [(even? e)

Re: [racket-dev] for loops with interleaved escape continuations

2014-07-01 Thread Sam Tobin-Hochstadt
On Wed, Jul 2, 2014 at 12:52 AM, John Clements cleme...@brinckerhoff.org wrote: On Jul 1, 2014, at 3:46 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I disagree strongly that this is un-rackety. Consider the following loop: (define v ) (let loop ([i 100]) (define e (vector-ref v

Re: [racket-dev] for loops with interleaved escape continuations

2014-06-27 Thread J. Ian Johnson
There are a couple issues here, One is that #:when in for-clauses allows you to skip iterations, but you want it in the body. This is a cosmetic difference that you can get around by doing #:when (begin imperative-stuff-before-guard guard). If you want ecs to escape an entire for loop, that's

Re: [racket-dev] for loops with interleaved escape continuations

2014-06-27 Thread Jay Kominek
On Fri, Jun 27, 2014 at 8:40 PM, J. Ian Johnson i...@ccs.neu.edu wrote: One is that #:when in for-clauses allows you to skip iterations, but you want it in the body. This is a cosmetic difference that you can get around by doing #:when (begin imperative-stuff-before-guard guard). If you want

Re: [racket-dev] for loops with interleaved escape continuations

2014-06-27 Thread Danny Yoo
Hi Jay, Have not been following Racket development too closely lately, but perhaps you might find this helpful? http://planet.racket-lang.org/display.ss?package=while-loop.pltowner=dyoo _ Racket Developers list: http://lists.racket-lang.org/dev