使用regexp筛选表达式输出



main的错误代码是(string-match "module" (help uri-path)),返回错误

scheme@(guile-user) [5]> (string-match "module" (help uri-path))
`uri-path' is an object in the (web uri) module.
- Special Form: uri-path
While compiling expression:
Syntax error:
unknown file:9:23: sequence of zero expressions in form (begin)
scheme@(guile-user) [5]>

我试图达到的是,只显示一行帮助功能输出。如何修复?

使用procedure-documentation以字符串形式获取过程的文档。

scheme@(guile-user)> (help cons)
`cons' is a procedure in the (ice-9 safe-r5rs) module.
- Scheme Procedure: cons x y
Return a newly allocated pair whose car is X and whose cdr is Y.
The pair is guaranteed to be different (in the sense of `eq?') from
every previously existing object.
scheme@(guile-user)> (procedure-documentation cons)
$6 = "- Scheme Procedure: cons x yn     Return a newly allocated pair whose car is X and whose cdr is Y.n     The pair is guaranteed to be different (in the sense of `eq?') fromn     every previously existing object."

最新更新