SketchyLISP Reference |
Copyright (C) 2007 Nils M Holm |
<<[char>=?] | [Index] | [depth]>> |
Conformance: SketchyLISP Extension
Purpose: Recursively count the atoms of a list. Members of all sublists are included.
Arguments:
X - list
Implementation:
(define (count x) (cond ((null? x) 0) ((pair? x) (+ (count (car x)) (count (cdr x)))) (else 1)))
Example:
(count '(a b (c (d) e) ((f)))) => 6
<<[char>=?] | [Index] | [depth]>> |