统计集合元素的数量不允许使用count操作
Write a function which returns the total number of elements in a sequence.
用递归搞定
(fn d [seq]
(if (empty? seq)
0
(+ (d (rest seq)) 1)))
统计集合元素的数量不允许使用count操作
Write a function which returns the total number of elements in a sequence.
用递归搞定
(fn d [seq]
(if (empty? seq)
0
(+ (d (rest seq)) 1)))