我正在尝试使用Parenscript。当我尝试使用regex函数时,我得到了意想不到的结果。参考手册 显示。
(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等,都没有用。另外,为了检查一下,我试着使用函数sin、random等,结果成功了。我的意思是,在repl中输入(sin 0.1)产生了预期的输出。
任何帮助都会有很大的帮助。
在一个SBCL read-eval-print-loop中。
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编译器的一个宏操作符。