3 ms·
This is why I almost exclusively use COND in lisp. Each clause has the condition explicitly spelled out and I am much less likely to err.
by wglb 17y ago
This is why I almost exclusively use COND in lisp. Each clause has the condition explicitly spelled out and I am much less likely to err.
- zaphar 17y agoditto. I'm the same way in my lisp code. It's almost the only conditional I use. Well... maybe condp as well.
- gjm11 17y agoExcept that the last condition can be T, and that's exactly the same as "else" in a more conventional language.
- wglb 17y agoYes, in a way, but it happens much less often. If you leave off the final clause, then it is exactly equivalent of his rewritten example.
- gjm11 17y agoI don't think it is. The point of his rewrite is that at the end of each branch the function returns so that you don't have to remember so much to make sense of what it does. Sure, a COND that's the only (or final) form in the function that contains it has the same property, but the key thing there is that it's at the end, not that it's a COND. COND really is the same thing as if ... else if ... else ...; using that rather than IF when you have more than two branches is a good thing, for sure, but I don't see how it's good for the reason you give. Am I missing something?