Rev 65 | Blame | Compare with Previous | Last modification | View Log | RSS feed
irasnyd@duallie lisp $ cat hw05.lisp;;; Written By: Ira Snyder;;; Due Date: Wed 02-02-2005;;; Homework #: HW05;;;;;; Count the number of numbers in an arbitrary;;; depth expression;;;(defun COUNT# (E)(cond((numberp E) 1)((atom E) 0)(t (+ (COUNT# (car E))(COUNT# (cdr E))))))irasnyd@duallie lisp $ clisp -q[1]> (load 'hw05.lisp);; Loading file hw05.lisp ...;; Loaded file hw05.lispT[2]> (COUNT# nil)0[3]> (COUNT# 3)1[4]> (COUNT# 'a)0[5]> (COUNT# '(5 1 a 4))3[6]> (COUNT# '((1 1 (a)) 7 (b (3))))4[7]> (bye)irasnyd@duallie lisp $