很简单的一个提 代码如下
(defn last-pair[a] (if (empty? (rest a)) (first a) (last-pair (rest a) ) ))
获取列表最后一个元素,递归的办法如上。
京公网安备 11010502049817号