[Proto-Scripty] Re: Enumerable.each return and throw

2008-10-09 Thread T.J. Crowder
> You cannot re-do function above using each(). Well, you *can*, but given the richness of the Enumerable API, you're not likely to need to -- as you point out, any() is exactly what you want in the situation you describe, and if it weren't then all(), detect(), or collect() would probably suit.

[Proto-Scripty] Re: Enumerable.each return and throw

2008-10-09 Thread Tomasz Kalkosiński
On Oct 9, 12:23 pm, "T.J. Crowder" <[EMAIL PROTECTED]> wrote: > Or, if there's a situation where any() or all() doesn't suit, you can > break each() loops by throwing $break. Yes I can do it, but I cannot determine afterwards whether I've exited iteration with throwing $break or I've iterated thr

[Proto-Scripty] Re: Enumerable.each return and throw

2008-10-09 Thread T.J. Crowder
Or, if there's a situation where any() or all() doesn't suit, you can break each() loops by throwing $break. -- T.J. Crowder tj / crowder software / com On Oct 9, 10:04 am, Tomasz Kalkosiński <[EMAIL PROTECTED]> wrote: > Nah! I've just discovered Enumerable.any() and Enumerable.all(). That > shou

[Proto-Scripty] Re: Enumerable.each return and throw

2008-10-09 Thread Tomasz Kalkosiński
Nah! I've just discovered Enumerable.any() and Enumerable.all(). That should do the trick. Sorry for hassle Greetings, Tomasz Kalkosiński On Oct 9, 10:47 am, Tomasz Kalkosiński <[EMAIL PROTECTED]> wrote: > I'm refactoring old code and I use Enumerable.each() wherever > possible. I've came to p