Lisp HUG Maillist Archive

Re: two functions; which one is in the lisp way?

Thank you everybody for the replies! The reason why I asked was mostly that to me the use of error handling facilities in that example seemed "not the right way". Before posting I googled the Internet and found even this http://stackoverflow.com/questions/354038/how-do-i-check-if-a-string-is-a-number-in-python where using "try-catch" was praised which to me still looks weired in such an example no matter what the language.

And yes, the second example with handler-case (or ignore-errors) is actually slower around 4 times if you test it with "bad" data (like "123a"). Thanks to those who pointed that to me.

Best,
 Art


Re: two functions; which one is in the lisp way?

Art Obrezan wrote on Fri, 26 Nov 2010 09:52:40 -0800 (PST) 20:52:

| Thank you everybody for the replies! The reason why I asked was mostly
| that to me the use of error handling facilities in that example seemed
| "not the right way". Before posting I googled the Internet and found
| even this http://stackoverflow.com/questions/354038/how-do-i-check-if-a-string-is-a-number-in-python

You could also have looked at the meta-parse-number.lisp file in
Ystok-Library.
See http://lisp.ystok.ru/projects.html#ylib
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru


Updated at: 2020-12-10 08:38 UTC