1
这个问题肯定是之前问过的,here。除了在Command-line access and exit values的r6rs-lib
中提到的command-line
功能外,所提供的一些解决方案确实可行(在Windows中)。使用`命令行`功能在Scheme中获取命令行参数
我设法用*argv*
实现我在Gauche
想(非R6RS兼容的实现):
(display *argv*)
> gosh test.ss first 1 2 3 4 5 6 7 8 9 10 11 12 13
>> (first 1 2 3 4 5 6 7 8 9 10 11 12 13)
我想要做同样的Petite Chez Scheme
这是r6rs
使用command-line
功能兼容。我试图使用该章节中的代码,但我得到的只是一个带有脚本名称和第一个参数的列表。 e.g
#!r6rs
(import (rnrs programs (6)))
(display (command-line))
> petite --script test.ss first second
>> (test.ss first)
有一些其他的库导入我的思念,将使其工作?
猜猜看,代码在Ubuntu中按照预期运行。也许'娇小'的窗户安装被打破。它在'Windows'中适合你吗? – gebby
我没有Windows机器可以尝试。请投票表决,也许标记为“已回答”。 – GoZoner
我想我会给它更多的时间让有人用Windows芯片进去。我认为在Windows中实现该功能的方式有些问题,因为即使是Racket也不会返回所有的值。我用你的代码试了一下(我的错误像你说的那样),它返回'{C:\ mine \ .ss \ test.ss}'。其他人在Windows中获得相同的结果吗? – gebby