(defun Left (state)
(setq new_place (- (second state) 1))
(cond
((endp state) NIL)
((= (first state) 1) NIL)
(T (> (second state) 1) (list skoupa (- (second state) 1) (last state)))))
我无法理解这一行((endp state)NIL)NIL让我疯狂的目的是什么?我理解endp状态将导致True或NIL。例如,如果结果为True,那么我将((T)NIL)这是一个正确的陈述?结果是什么?
答案 0 :(得分:1)
我试图将其转换为伪代码。
在我的评论中添加if
,假设它应该是
(T (if (> (second state) 1)
(list skoupa (- (second state) 1))
(last state)))))
HTH。
function Left (state)
set new_place = (second state)-1
if state is empty
return NIL
else
if (first state) == 1
return NIL
else
if (second state) > 1
return (list skoupa (second state)-1
else
return (last state)