hongjing0501 发表于 2017-11-8 17:23:16

Foreach问题请教

代码如下:
执行的时候总是会报错:
E- *Error* foreach: second arg must be a symbol or list of symbols - 1e-009
ERROR
实在是找不到原因,请教大神!


(defun getname ()
namepopup = list()
c_path = (strcat getWorkingDir() "/" "comments")
if(isDir c_path)== nil then
axlUIConfirm("No comments or path is wrong!")
else
c_file = cdr(cdr(getDirFiles(c_path)))
d_file = car(c_file)
fbegin = "POPUP <namelist>"
n_list = strcat(fbegin "\"" d_file "\"\"" d_file "\".")
name_file = list(n_list)
foreach(1name c_file
namepopup = append(namepopup list(list(lname lname)))
)
)

hyper 发表于 2017-11-9 09:30:00

不知道你要做什么,代码格式整得有点乱
修改后的,工作正常
(defun getname ()
        namepopup = list()
        c_path = (strcat getWorkingDir() "/" "comments")

        (if isDir(c_path)== nil then
                axlUIConfirm("No comments or path is wrong!")
        else
                c_file = cdr(cdr(getDirFiles(c_path)))
                d_file = car(c_file)
                fbegin = "POPUP <namelist>"
                n_list = strcat(fbegin "\"" d_file "\"\"" d_file "\".")
                name_file = list(n_list)
                (foreach lname c_file
                  namepopup = append(namepopup list(list(lname lname)))
                )
        )
)

hongjing0501 发表于 2017-11-9 09:53:34

hyper 发表于 2017-11-9 09:30
不知道你要做什么,代码格式整得有点乱
修改后的,工作正常
(defun getname ()


谢谢,我是想实现传递一个文件夹下面的文件给一个列表。
页: [1]
查看完整版本: Foreach问题请教