On Wed, 24 Mar 2010 13:52:08 -0700, "Jonathan S. Shapiro" <[email protected]> wrote: > On Wed, Mar 24, 2010 at 1:11 PM, Michal Suchanek <[email protected]> wrote: > > > > I would say that foreach cycle and while cycle are fundamentally > > different and while you can make them use the same keyword and similar > > syntax it does not change that. > > I agree. I made an unfortunate choice of subject line. The cases I'm > actually concerned about here are the "while" and "do" loop cases. The > "do" loop is easier. > > > The while cycle is in its nature imperative, would probably need an > > infinite if-else branching to represent in a pure way in the general > > case and the very simple while(1) is in itself infinite. > > I'm not convinced of this. It is certainly possible to encode while > loops using the LISP-style loop construct, which relies on tail-call > to remove the requirement for imperative termination expressions. > > But the *price* of the LOOP mechanism is its syntactic complexity. It > would be pleasant to find something cleaner than that.
Sorry if I'm way off base, but AIUI there's something which one could call a syntax-less (or -light, depending on what's your take on Lisp's syntax) version of Common Lisp's LOOP -- ITERATE: http://common-lisp.net/project/iterate/ Usage roughly looks like: (iterate (generate i from 0 to 6) (for (key . value) in '((a . 2) (zero . 10) (one . 20) (d . 5))) (when (>= value 10) (collect (cons key (next i))))) -- regards, Samium Gromoff -- "Actually I made up the term 'object-oriented', and I can tell you I did not have C++ in mind." - Alan Kay (OOPSLA 1997 Keynote) _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
