On 9/3/07, Vimal <[EMAIL PROTECTED]> wrote: > > Hi > In my Paradigms of Programming course, my professor presents this piece of > code: > > while E do > S > if F then > break > end > T > end > > He then asked us to *prove* that the above programming fragment cannot > be implemented just using if and while statement, even if S and T can > be duplicated a finite number of times
But it IS possible. Just add a boolean flag: done = False while E and not(done) do... I'll let you work out the rest. Unless I am missing something here... are you not allowed to introduce extra variables? It's a strange thing for your professor to ask, since under reasonable assumptions, anything that is computable can be done only using if and while. goto (which is essentially what break is) is never necessary. -Brent
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe