The problem with return 0 is that it's true - in list context. The only false list is the empty list and yours has one element.
Your approach separates a single statement into three distinct ones and will execute that way too. There is in fact loss of efficiency associated with using blocks there. The interpreter cannot optimize anything in the first place, and if you meant compiler optimization, it won't salvage any efficiency because it's rather rudimentary even if it has a few clever tricks for some highly specific cases.
And not only does it execute that way, it has to be read like that too, with far more brackets and keywords around to grok. Compare the plain-English translations:
if an assertion fails abort the function, if a second assertion fails abort the function, if still here then return truevs
return the combined success of assertion one and two
You tell me which one is more fluidly readable. Remember - source code is only coincidentally machine interpretable, its main purpose is to be read by a programmer.
Makeshifts last the longest.
In reply to Re^4: Pattern Matching Query
by Aristotle
in thread Pattern Matching Query
by Elgon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |