带有警告的编译全局变量

问题描述

使用以下命令编译文件后:

compile_file("filename.mac");

我在文件名中得到一个警告。UNLISP:

警告:在翻译中遇到未定义的变量foo。

文档说要使用该功能

define_variable (name,default_value,*mode*);

但是,如果在* mode *模式下,我写的不是“ any”,例如:

define_variable(foo,false,boolean)$

然后我在重新编译时收到错误消息:

#无法可读地打印。

是否可以声明一个变量,以便在没有此警告的情况下编译成功?使用mode_declare声明吗?

示例代码 filename.mac

define_variable(foo,true,boolean)$ /* useless string */
foo: true$

exprp(that) := if foo = false and listp(that) and not emptyp(that) and member(that[1],["+","*"]) then(foo: true,true)$
matchdeclare(exprm,exprp)$
defrule(rule_1,exprm,subst(exprm[1],"[",exprm[2]))$

calc(list) := block([steps: []],while foo do(
    steps: endcons(list,steps),foo: false,list: applyb1(list,rule_1)
),steps
)$

calc(["+",[["*",[1,2,3]],[3,4,6]]]]);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)