11 lines
242 B
EmacsLisp
11 lines
242 B
EmacsLisp
;; P04 (*) Find the number of element of a list
|
|
(defun my-length (lst)
|
|
(defun my-length-rec (lst res)
|
|
(cond
|
|
((eq lst '()) res)
|
|
(t
|
|
(my-length-rec (cdr lst) (+ 1 res)))))
|
|
(my-length-rec lst 0))
|
|
|
|
(my-length '(a b c)) ; 3
|