newLISP Fan Club

Forum => newLISP in the real world => Topic started by: newdep on April 28, 2008, 02:35:13 PM

Title: A dime for a nickle - use the power of the "or"
Post by: newdep on April 28, 2008, 02:35:13 PM
When you always want to have a return value of 'true

even though the result is 'nil use the power of the "or"





(and

 (I-return-true)

 (or (I-could-return-nil-function) 'true)

 (i-could-be-next))





That will always return true!



Why this stupid trick?



... depends on your way of programming,

but if you use a lot of "and' , "when" to compare results

its sometimes needed to force a 'true to make sure the

whole evaluation is completed, instead of popping out at 'nil.





;-)