Reputation: 1266
I am writing a program in Scheme which needs to examine the command line arguments. I figure a good way to get an executable is to use Chicken Scheme to compile the thing, but then I am running into problems:
Here are the contents of test.sch
(display (command-line))
I am invoking the compiler like so:
csc -require-extension r5rs test.sch
Which gives the following warning:
Warning: extension `r5rs' is currently not installed
but proceeds to generate an executable test
. That executable, when run,
$ ./test
Error: (require) cannot load extension: r5rs
Call history:
##sys#require <--
Is r5rs
an extension? I don't think so, since chicken-install
doesn't seem to know about it:
$ chicken-install r5rs
Error: unrecognized file-information - possibly corrupt transmission: "(error \"no such extension or version\" \"r5rs\" #f)"
I think I need to import r5rs
to get the procedures (display)
and (command-line)
. But I cannot figure that out. I'd appreciate if someone can explain what I need to do to these two procedures bound so that
I can examine the command line arguments
I can print to the console
Upvotes: 1
Views: 927
Reputation: 48765
Command line arguments are not a part of the R5RS or any other of the Scheme reports. Every implementation that supports a method has their own way and Chicken uses the built in parameter command-line-arguments
:
$ echo '(display (command-line-arguments))' > test.scm
$ csc test.scm
$ ./test 1 2 3
(1 2 3)
Edit: The (command-line-arguments)
documentation has since been updated for Chicken 5, which you can view in documentation under Using the interpreter.
Upvotes: 1