You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ordinary Racket functions accept individually named arguments, but also packed "rest" arguments using the dot notation:
(define (func . args)
body ...)
With #lang cli, we'd like to support something similar:
(program (prog . args)
body ...)
and
(program (prog . [args "Files to process"])
body ...)
... would be ideal. But I seem to recall that it's tricky (impossible?) to match the literal dot in macros. So it may be necessary to use a custom syntax to indicate that arguments should be collected into a list. Example:
(program (prog (rest args))
body ...)
and
(program (prog . (rest [args "Files to process"]))
body ...)
Note that Racket's built-in command-linedoes support this kind of argument packing, and it too is implemented on top of parse-command-line, as #lang cli is. So it should be possible to leverage the built-in facilities for this.
Workaround: At the moment, we can use the multi constraint to pass multiple arguments via a flag.
The text was updated successfully, but these errors were encountered:
Ordinary Racket functions accept individually named arguments, but also packed "rest" arguments using the dot notation:
With
#lang cli
, we'd like to support something similar:and
... would be ideal. But I seem to recall that it's tricky (impossible?) to match the literal dot in macros. So it may be necessary to use a custom syntax to indicate that arguments should be collected into a list. Example:
and
Note that Racket's built-in
command-line
does support this kind of argument packing, and it too is implemented on top ofparse-command-line
, as#lang cli
is. So it should be possible to leverage the built-in facilities for this.Workaround: At the moment, we can use the
multi
constraint to pass multiple arguments via a flag.The text was updated successfully, but these errors were encountered: