| Paste number 91564: | untitled |
| Pasted by: | Shamiq |
| When: | 9 months, 2 days ago |
| Share: | Tweet this! | http://paste.lisp.org/+1YNG |
| Channel: | #lisp |
| Paste contents: |
;;Checks an s-expression for the existence of any numbers.
(defun has-number-p (s-exp)
(cond ((null s-exp) nil)
((atom s-exp) (numberp s-exp))
(t (or (some #'numberp s-exp)
(has-number-p (car s-exp))
(has-number-p (cdr s-exp))))))Annotations for this paste:
| Annotation number 1: | two ways |
| Pasted by: | gigamonkey |
| When: | 9 months, 2 days ago |
| Share: | Tweet this! | http://paste.lisp.org/+1YNG/1 |
| Paste contents: |
(defun has-number-p (sexp)
(if (atom sexp) (numberp sexp) (some #'has-number-p sexp)))
(defun has-number-p (sexp)
(if (atom sexp)
(numberp sexp)
(or (has-number-p (car sexp)) (has-number-p (cdr sexp)))))