本文介绍了如何在LISP中进行while循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法通过简单的while循环在Lisp中工作!
I cannot get a simple while loop to work in lisp!
(loop (while (row >= 0))
setf(row (- row 1))
(collect (findIndex row col))
当row大于或等于0时,我要减少行并收集findIndex方法给出的结果.假设col已经给出.
while row is more or equal to 0 i want to decrement row and collect the result given by findIndex method.Suppose the col is given.
谢谢!
推荐答案
以下是正确的循环形式:
The correct form of the loop is the following:
(loop while (>= row 0)
do (setf row (- row 1)) ; or better: do (decf row)
collect (findIndex row col))
有关循环语法的详细说明,请参见手册.
For a detailed description of the loop syntax, see the manual.
这篇关于如何在LISP中进行while循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!