相关疑难解决方法(0)

了解Common Lisp中的tailp

在浏览Bert Burgemeister的"Common Lisp Quick Reference"时,我偶然发现了tailp.

首先,我误解了这个函数的定义.我试过了:

(tailp '(3 4 5) '(1 2 3 4 5))
Run Code Online (Sandbox Code Playgroud)

但它回来了

NIL
Run Code Online (Sandbox Code Playgroud)

CLTL2说,如果第一个参数是任何存在的,tailp则为真.(nthcdr n list)n

(nthcdr 2 '(1 2 3 4 5))
;; (3 4 5)
Run Code Online (Sandbox Code Playgroud)

我进一步尝试:

(tailp '(3 4 5) '(1 2 3 4 5))
;; NIL - and I would expect: T following the definition above.

(tailp '() '(1 2 3 4 5))
;; T
(tailp '5  '(1 2 3 4 . 5))
;; T …
Run Code Online (Sandbox Code Playgroud)

lisp clisp common-lisp

4
推荐指数
1
解决办法
208
查看次数

标签 统计

clisp ×1

common-lisp ×1

lisp ×1