Paste number 91564: untitled

Index of paste annotations: 1

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:
Raw Source | XML | Display As
;;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:
Raw Source | Display As
(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)))))

Colorize as:
Show Line Numbers
Index of paste annotations: 1

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.