foreach

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 13 15:54:12 PDT 2014


On Fri, Jun 13, 2014 at 10:34:09PM +0000, via Digitalmars-d wrote:
[...]
> On Friday, 13 June 2014 at 22:21:15 UTC, Meta wrote:
> >It's a joke, though I suppose not a very good one. If 1 == 1 doesn't
> >indicate a condition that should never be false to you, then you're
> >bad at math.
> 
> Imagine each infinite loop requiring a unique equation, where the
> right and left sides must be different before evaluation. Now you can
> yell at people for not getting that, I dunno, some complex expression
> is 42 or -1 or whatever.

People often fail to appreciate the fact that a sufficiently complex
loop, in general, is impossible to be proven to terminate, because it is
equivalent to the Halting Problem (which is unsolvable).

For example, will this code ever terminate?

	BigInt n=4;
	while (isSumOfTwoPrimes(n))
	{
		n += 2;
	}


T

-- 
Public parking: euphemism for paid parking. -- Flora


More information about the Digitalmars-d mailing list