Cadence Skill 论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4102|回复: 2

Foreach问题请教

[复制链接]
发表于 2017-11-8 17:23:16 | 显示全部楼层 |阅读模式
代码如下:
执行的时候总是会报错:
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)))
)
)
发表于 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)))
                )
        )
)
 楼主| 发表于 2017-11-9 09:53:34 | 显示全部楼层
hyper 发表于 2017-11-9 09:30
不知道你要做什么,代码格式整得有点乱
修改后的,工作正常
(defun getname ()

谢谢,我是想实现传递一个文件夹下面的文件给一个列表。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|网站地图|Cadence Skill 论坛 ( 蜀ICP备13024417号 )

GMT+8, 2024-4-26 15:33 , Processed in 0.129556 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表