Rebol 函数和无限参数

发布于 2024-08-02 12:48:30 字数 57 浏览 1 评论 0原文

rebol 中的 do 函数似乎接受无限的参数。我可以用我自己的函数来做到这一点(不使用参数块)吗?

The do function in rebol seems to accept unlimited arguments. Can I do that with my own function (without using a block of arguments) ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最近可好 2024-08-09 12:48:30

无法定义具有可变数量参数的函数。此 Rebol 邮件列表线程中的最后一条消息 http://www.rebol .org/ml-display-thread.r?m=rmlDTXB 有解释。

do 函数也有一个参数:

>> ? do
USAGE:
    DO value /args arg /next 

DESCRIPTION:
     Evaluates a block, file, URL, function, word, or any other value.
     DO is a native value.

ARGUMENTS:
     value -- Normally a file name, URL, or block (Type: any)

REFINEMENTS:
     /args -- If value is a script, this will set its system/script/args
         arg -- Args passed to a script. Normally a string. (Type: any)
     /next -- Do next expression only.  Return block with result and new position.

It is not possible to define a function with a variable number of arguments. The last message in this Rebol Mailing List thread http://www.rebol.org/ml-display-thread.r?m=rmlDTXB has an explanation.

Also the do function takes a single argument:

>> ? do
USAGE:
    DO value /args arg /next 

DESCRIPTION:
     Evaluates a block, file, URL, function, word, or any other value.
     DO is a native value.

ARGUMENTS:
     value -- Normally a file name, URL, or block (Type: any)

REFINEMENTS:
     /args -- If value is a script, this will set its system/script/args
         arg -- Args passed to a script. Normally a string. (Type: any)
     /next -- Do next expression only.  Return block with result and new position.
梦回旧景 2024-08-09 12:48:30

你是对的,REBOL 中有可变参数函数,一个例子是 DO 函数。在 R2 中,甚至 MAKE 函数也是可变的。然而,函数规范方言不允许您定义自己的可变参数函数,并且甚至没有计划这样的功能。

You are right, that in REBOL there are variadic functions, an example being the DO function. In R2, even the MAKE function is variadic. Nevertheless, the function specification dialect does not allow you to define your own variadic function, and such a feature isn't even planned.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文