Arc Forumnew | comments | leaders | submitlogin
Anarki now works inside a Unix Emacs shell
3 points by zck 3402 days ago | 1 comment
I just pushed an improvement to Anarki's Unix script^1. It now uses getopts^2 to parse arguments, and now it can take two args. The complete help text:

    arc [-n] [-h] [<file> [<file_args>]]
            No rlwrap
            Print help and exit
        <file> [<file_args>]
            Don't start up a REPL; instead, execute the file, passing to it any file_args. When the file finishes executing, exit Arc.
        Start the Arc REPL.
        Start the Arc REPL without rlwrap
            arc -n
        Run the file "file-to-run.arc", passing to it the argument 3
            arc file-to-run.arc 3
So I'm now able to use Anarki inside emacs, if I pass the -n argument, so it doesn't use rlwrap. This will stop my constant carping about how I don't use Anarki, and downgrade it to constant confusion about what's changed from Arc3.1.

As a side note, how do you receive arguments inside a script? In the example above (arc file-to-run.arc 3), how do I get the value 3 inside file-to-run.arc? The file itself runs fine; I just don't know how to get arguments.



3 points by akkartik 3402 days ago | link

Just look inside argv.

  $ cat x.arc 
  (write argv)
  $ arc x.arc a b c
  ("x.arc" "a" "b" "c")
Many thanks! I'd love to hear feedback on the big differences with arc 3.1 that trip you up. We could always revert them.