This is a construct that is very useful to avoid either a redundant check or a goto. This... for(a;b;c) {
expr1;
if(d) {
expr4;
goto done;
}
expr2;
}
expr3;
done:
...becomes... for(a;b;c) {
expr1;
if(d) {
expr4;
break;
}
expr2;
} done {
expr3;
}
where the intent is for statements in a done clause immediately following a loop to be executed if and only if the loop was exited via its termination condition being reached. This also generalises for while() and do-while, here using some common examples.
while(*j) {
if(*j++ == k) {
u = v + k;
break;
}
} done
u = v - k;
do {
if(f(a[i]))
break;
} while(a[i++]) done {
g();
}
Discuss.
Name:
Anonymous2013-01-07 8:00
So, like a finally except for conditional statements? Sounds interesting.
This is very useful for writing array searches and the like, as otherwise you either have to check for notfound/loop terminated a second time (stupid) or use a goto (which pisses off the purists).
Name:
Anonymous2013-01-07 8:02
>>4
People who don't know the length of an array beforehand should be lined up and shot O(n) times.
>>5
What if the problem requires me to append stuff into the array while looping through it.
Name:
Anonymous2013-01-07 8:09
>>1
Any sufficiently complicated C or Fortran program contains an ad hoc informally-specified bug-ridden slow implementation of half of Common Lisp. -- Greenspun's Tenth Rule
Name:
Anonymous2013-01-07 8:10
Any language that doesn't let me define more syntax is shit.
There's nothing wrong with goto as a tool and it's only the shit-eating fuckstains, lapping up every bit of ethos they can and mindlessly spewing the same fetid, putrid nonsense without actually thinking about it, who actually think a language construct (that compiles to the same machine code as everything else) could ever possibly be a problem. Fuck their shitty fucking shit.
>>24 not good for actual work.
What does that mean? It's turing-complete isn't it? It's not easy to compose code to achieve complex behaviour that's easy to maintain?
Name:
Anonymous2013-01-08 7:20
>>24 not good for actual work.
What does that mean? It's turing-complete isn't it? It's not easy to compose code to achieve complex behaviour that's easy to maintain?
>>24 Lisp is like a drug; fun to get high on, not good for actual work.
While lisp is like a drug, and is fun to get high on, it is also good for actual work. Just look at this thread. The implementation of this new syntax is a trivial exercise in lisp. You wouldn't need to convince anyone or any compiler writers to adopt it, you could just implement it as a macro and include it in your project. And it would be portable too, since the macro would work on any compiler that implements the language. But then other people would need to read your new syntax. List itself isn't comparable to C however. There are too many features. It's too challenging to write an optimizing compiler, and C has advantages in enforcing resource use at the language level. A Lisp dialect that is essentially C in an ast would work, but when you throw static types into lisp the parentheses become a little overwhelming, at least more overwhelming than the semi colons and commas in C. If the macros in C could traverse and manipulate C's ast, then you would have no problems. All that's needed for this is a standard grammar for C compilers to follow and it can be exposed.
I don't want to return. I want to continue immediately after that.
An inline function would do the trick.
It would be great if Cudder killed himself out of 4chan forever.
Name:
Anonymous2013-01-09 13:50
>>40
Culver easily, even though she supports kike languages (FIOC, javashit), that can be easily ignored. Cudder's rabid fanboy support of kike chip architecture on the otherhand is seriously harmful, also unacceptable.
>>46
Fuck you, I saw her first.
I don't want platonic love I want to pump her ass full of cum while she declaims the Intel manuals and then we shall take a romantic walk on the Nevskaya Perspektiva and do some shopping.
Why such a poor choice of operator? call/CC is less primitive and less powerful then shift and reset. If you want callCC you can implement it with shift and reset.
I am going to puke over Jesus now.
Name:
Anonymous2013-01-10 7:15
>>52
You can implement shift and reset with call/cc as well.
>>54,55
How so? I'd say it's far cleaner to write a separate function like 'searchuranus' then branch depending on its return value, rather than using what you've proposed. Performing an extra comparison on a null pointer really isn't a huge issue, especially with high level languages where clarity and the use of idiomatic forms is far more important than unnoticeable performance gains. If you run a large program through a profiler and find that it performs poorly, chances are it's because an inefficient data structure was used, rather than using two comparisons where one would have been sufficient.