我正在尝试 Parenscript。在尝试使用正则表达式函数时,我得到了意外的输出。例如,参考手册 https://common-lisp.net/project/parenscript/reference.html shows:
(regex "foobar")
/foobar/;
(regex "/foobar/i")
/foobar/i;
但是,在我的 repl 中,我收到错误,函数 (parenscript:regex..) 未定义。
The function parenscript:regex is undefined.
[Condition of type undefined-function]
Restarts:
0: [continue] Retry using regex.
1: [use-value] Use specified function
2: [retry] Retry SLIME REPL evaluation request.
3: [*abort] Return to SLIME's top level.
4: [abort] abort thread (#<thread "repl-thread" running {1002319B63}>)
Backtrace:
0: (sb-impl::retry-%coerce-name-to-fun regex nil)
1: (sb-int:simple-eval-in-lexenv (regex "foobar") #<NULL-LEXENV>)
2: (eval (regex "foobar"))
--more--
我尝试将命名空间更改为 cl-user、ps 等,但没有任何效果。 OTOH,只是为了检查,我尝试使用函数 sin、random 等,并且有效。我的意思是,在 repl 中输入 (sin 0.1) 会产生预期的输出。
任何帮助都会有很大帮助。
在 SBCL 读取-求值-打印循环中:
CL-USER> (in-package "PS")
#<PACKAGE "PARENSCRIPT">
PS> (ps (regex "foobar"))
"/foobar/;"
PS> (in-package "CL-USER")
#<package "COMMON-LISP-USER">
cl-user> (ps:ps (ps:regex "foobar"))
"/foobar/;"
PS:PS
是 Parenscript 编译器作为宏运算符。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)