*zing* ... *lmao* (I didn't see that coming)
My call: no. Not in this case. I say that because of the orig. scope of the request. The author is asking for a test to test numbers from 1-50. HOWEVER! i know that's the ``easy'' route here. -i.e. i know most people are most likely not going to ensure only int's get tested if they just toss this into their library and use it later but he does use the `fix' procedure in this case so...but, again that's kind of a cop out. Maybe i should just note that in my header that if you plan to use this or if there is a chance that there will be other types of numbers besides int's tested please seek other methods.
It all comes down to personal preference. When creating applications i prefer the proced's to be as ``little'' as they can (And by that i mean to not add too much more as far as scope goes) to save on readability and time. Its not that I would much rather come back with a diff revision later, but i like to keep my code as lean as possible.
I guess what it comes down to is: `Fun' is fun, but `production' is diff. ...I love creating procedures that take into account alot of diff situations for fun, but in production I create what needes to be created.
That's why I love using block structure in my code; I can come back and totaly change the application by adding a few lines here and a few there.
For example.
Orig: (defun odd? (i) (logand i 1) )
New:
(defun odd? ( i )
;; determine if a number is odd?
;; scope: numbers 1 -- 50 only
(if (and (>= i 0) (<= i 50))
(logand i 1)
'*Error* ) )
I dont know, its a wash I suppose.
CAB, It creates maintence issues with the code. Its a bit redundant. HOWEVER! if you are in need of a way to ``test for evens'' in a diff proced, then i can see using it. (Im saying try to name your procedures in the spirit of your application. -e.g. if you spend 100 lines `talking about evens' and then all of a sudden you `test for odd' becuse you were to lazy to alter a library function then...)