Re: [racket-dev] Short-circuiting comprehensions

2012-09-18 Thread Eli Barzilay
On Friday, Matthew Flatt wrote: > > Meanwhile, to support breaking after the current element, I'm trying > out `#:final'. A `#:final' clause is like `#:break', except that it > ends the loop after the next run of the body. [...] (When I first saw this, I thought that it was a kind of a "the value

Re: [racket-dev] Short-circuiting comprehensions

2012-09-14 Thread Carl Eastlund
I like most of that and don't object to the rest, except for leaving out a version of #:break-unless. Especially because "break" is already a negative word. Just like #:unless (bad?) is more natural than #:when (not (bad?)), #: (ok-to-continue?) is more natural than #:break (not (ok-to-continue?)

Re: [racket-dev] Short-circuiting comprehensions

2012-09-14 Thread John Clements
On Sep 14, 2012, at 1:14 PM, Robby Findler wrote: > My $0.02: I find #:while and #:when to be too close, and #:until and > #:unless even closer. More bike-shedding: I agree. In response to eli: I find the difficulty of reading "break-when" to be an adequate cost to pay to highlight the differen

Re: [racket-dev] Short-circuiting comprehensions

2012-09-14 Thread Matthew Flatt
At Fri, 14 Sep 2012 15:30:22 -0400, Eli Barzilay wrote: > Four hours ago, Matthew Flatt wrote: > > > > Also, I think the names `#:while' and `#:until' are too close to > > `#:when' and `#:unless'. I suggest `#:break-when' and `#:break-unless'. > > Compare: > > > > > (for*/list ([j 2] [i 10] #:wh

Re: [racket-dev] Short-circuiting comprehensions

2012-09-14 Thread Robby Findler
My $0.02: I find #:while and #:when to be too close, and #:until and #:unless even closer. Robby On Fri, Sep 14, 2012 at 2:30 PM, Eli Barzilay wrote: > 5 hours ago, Carl Eastlund wrote: >> >> Has this been brought up before? I can't recall. Does anyone else >> run into the same issue? > > (I t

Re: [racket-dev] Short-circuiting comprehensions

2012-09-14 Thread Eli Barzilay
5 hours ago, Carl Eastlund wrote: > > Has this been brought up before?  I can't recall.  Does anyone else > run into the same issue? (I think that I brought this up when the comprehensions were first discussed, pointing at the similar tool I have in Swindle which makes implementing them very easy

Re: [racket-dev] Short-circuiting comprehensions

2012-09-14 Thread J. Ian Johnson
+1 I've been using let/ec for this same functionality, and it's made me sad. -Ian - Original Message - From: "Carl Eastlund" To: "Matthew Flatt" Cc: "PLT Developers" Sent: Friday, September 14, 2012 11:49:20 AM GMT -05:00 US/Canada Eastern Su

Re: [racket-dev] Short-circuiting comprehensions

2012-09-14 Thread Carl Eastlund
I agree that #:while and #:until are easily confused with #:when and #:unless. I slightly prefer #:stop- to #:break- as a prefix here, it seems a more natural word. I like the idea of allowing these clauses at the end of the body to give a notion of stopping after the current iteration. I had be

Re: [racket-dev] Short-circuiting comprehensions

2012-09-14 Thread Matthew Flatt
I think this is a good idea. The technique to implement it is embedded in `for/vector' (to handle a vector length), and I can generalize that and move it into `for...'. Also, I think the names `#:while' and `#:until' are too close to `#:when' and `#:unless'. I suggest `#:break-when' and `#:break-u

[racket-dev] Short-circuiting comprehensions

2012-09-14 Thread Carl Eastlund
I would like the for/... comprehension macros to have #:while and #:until clauses similar to the #:when and #:unless clauses. I often find I want to short-circuit the sequence at some point, but there is no elegant way to do it. I could probably write sequence-while and sequence-until, but I don'