- Code: Select all
f(iter, p)
{
if (iter == null)
{
();
}
else
{
f(iter++, {iter#p;});
}
}
And how is it different than
- Code: Select all
f(iter, p)
{
if (iter == null)
{
();
}
else
{
f(iter, {iter++#p;});
}
}
f(iter, p)
{
if (iter == null)
{
();
}
else
{
f(iter++, {iter#p;});
}
}
f(iter, p)
{
if (iter == null)
{
();
}
else
{
f(iter, {iter++#p;});
}
}
quantus wrote:What is iter? I'll assume it's some class that implements an iterator...
Peijen wrote:I am pretty sure neither version works correctly as intended.
Peijen wrote:The second code doesn't work because {iter++#p} does not get evaluated until iter==null which never happends.
f(iter, p)
{
if (iter == null)
{
();
}
else
{
k = iter++#p;
f(iter, k);
\\ or you can do the following with the same effect.
\\ k = iter#p;
\\ f(++iter, k);
}
}
Users browsing this forum: No registered users and 1 guest