了解结构(第 . 内容)和继续教育

Understanding a construction (para . contents) and continuing education

我刚刚开始学习 Scheme Lisp,需要一些启发。我在网站 https://www.gnu.org/software/guile/manual/html_node/Types-and-the-Web.html that I haven't caught (para . contents)

上点击了一个片段

这并没有导致任何错误 shell 代码段的词或多或少被用作关键字或内置函数。我没有找到在互联网上解释的 para 函数。此外,点 . 在表达式中似乎很奇怪。

谁能解释一下它的语法并提供所有 Scheme Lisp 函数的网络索引,好吗?

[更新:感谢用户 coredump 对可变参数的澄清]

你没有在任何地方找到 para,因为它在那里定义 — 它是一个具有可变数量参数的函数定义:

(define (para . contents)
    (string-append "<p>" (string-concatenate contents) "</p>"))

它的作用是定义一个函数,该函数将多个字符串作为参数,然后存储在名为 contents 的列表中,returns 是一个包含以下内容的字符串HTML 围绕您传入的内容的 p 标签。

所以你可以这样称呼它

(para "This is a sentence. " "And another one. " "The third one. ")

(注意句点后的空格。)它会 return

"<p>This is a sentence. And another one. The third one. </p>"

关于 Scheme 函数的索引:看看 Scheme Standard(link 用于 R5RS)。