Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道我们有一个计算列表中项目数的函数,但是在这个过程中我不能使用这个函数。那么如何计算列表中元素的数量。
(define (last_element l count ) (+ count 2) (if (null? cdr l) done (last_element (cdr l) count))) (last_element (list 1 2 3 4 5) 0)
(define (mylength2 l count) (if (null? l) count (mylength2 (cdr l) (+ count 1))))