I\'m trying to create a function to count all the elements in a list, including the elements of its sublists. initially, to get started, i came up with a basic function
Make my-length work for any argument type, list or 'atom'; then the recursive algorithm becomes almost trivial:
my-length
(define (my-length l) (cond ((null? l) 0) ((list? l) (+ (my-length (car l)) (my-length (cdr l)))) (else 1))) ; atom > (my-length '(1 (1 (1 1)) 1))) 5