Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. (defun nombres (liste)
  2. (cond
  3. ((atom liste) 0)((atom (car liste)) 0)
  4. ((and (numberp (caar liste)) (+ (nombres (cdr liste)) 1)))
  5. (t (nombres (cdr liste))) ) )
  6.  
  7. [67]> (nombres '((a b d) (5 g) (7 m)))
  8. 2
  9. [68]> (nombres '((a b d) (5 g) g (7 m)))
  10. 1
  11.  
  12. [69]> (defun nombres (liste)
  13. (cond
  14. ((atom liste) 0)((atom (car liste)) 0)
  15. ((listp (car liste))(and (numberp (caar liste)) (+ (nombres (cdr liste)) 1))) (t (nombres (cdr liste))) ) )
  16. NOMBRES
  17. [70]> (nombres '((a b d) (5 g) g (7 m) m))
  18. NIL
  19.  
  20. (nombres '((a b d) a (5 g) (b) (7 m) j (8 h l g)))
  21. 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement