【发布时间】:2020-10-31 13:54:22
【问题描述】:
所以我在 Lisp 中编写了这个函数,它计算列表中有多少单词不是以给定字母开头。 但是我现在需要编辑它并且不在我的函数中使用“let”(但保留“char”和“string”)。 当我开始 Lisp 不久,感觉有点受阻!任何人都可以帮助我吗?
示例:
(others 'n '(art nose foot nose take silence never)) => 4
这就是我所做的,但需要删除“让”:
(defun others (x liste)
(let ((c (char (string x) 0)))
(cond
((not liste) 0)
((char= (char (string (car liste)) 0) c) (others x (cdr liste)))
(t (+ 1 (others x (cdr liste)))) ) ) )
【问题讨论】:
-
测试空列表的函数称为
null。
标签: lisp common-lisp clisp