小编Aka*_*sha的帖子

为什么内循环收集不返回结果?

我试图使用标准循环设施来收集结果,但它只返回 nil。为什么是这样?感觉这应该有效:

 (defun coll-intersects (bounds mv)
   (let ((res (list))
     (loop for x from (first bounds) to (+ (first bounds) (third bounds)) do
       (loop for y from (second bounds) to (+ (second bounds) (fourth bounds))
             if (not (member (cl-byte (aref mapa x y)) mv))
             collect (aref mapa x y) into res
             ))))
Run Code Online (Sandbox Code Playgroud)

但不,我必须这样做:

  (defun coll-intersects (bounds mv)
    (let ((res (list)))
     (loop for x from (first bounds) to (+ (first bounds) (third bounds)) do
       (loop for y from (second bounds) to (+ …
Run Code Online (Sandbox Code Playgroud)

loops common-lisp

2
推荐指数
1
解决办法
58
查看次数

标签 统计

common-lisp ×1

loops ×1