Check if its number

Discussion of Common Lisp
Post Reply
vasko
Posts: 7
Joined: Mon Mar 21, 2011 4:45 pm

Check if its number

Post by vasko » Mon Mar 21, 2011 4:49 pm

I need help with function that checks if all elements are numbers

for example:


(checkn '(1 2 3 a 4 5)) -> ()
(checkn '((1 2) 3 ((4 (1 2) a) 6 b))) -> ()
(checkn '((1 2) 3 ((4 (1 2) a) 6 b))) -> t

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Check if its number

Post by nuntius » Mon Mar 21, 2011 6:11 pm

Look up NUMBERP in the Numbers Dictionary.

Chapters 5 and 6 each have solutions for using this on lists of data.

vasko
Posts: 7
Joined: Mon Mar 21, 2011 4:45 pm

Re: Check if its number

Post by vasko » Tue Mar 22, 2011 3:22 am

thank you

Post Reply