如何在鸡肉中使用getopt-long
?
我有以下代码:
(require 'getopt-long)
(define grammar
`((help (required #f)
(value #f)
(single-char #\h))
(limit (required #t)
(value #f) ;; optional value
(single-char #\l)
(value (required INTEGER)
(predicate ,integer?)))
))
(getopt-long '(program-arguments) grammar)
但是当我尝试使用csi
运行代码时,出现以下错误:
Error: unbound variable: getopt-long
Call history:
<eval> (##sys#list (##sys#list (##core#quote help) (##sys#list (##core#quote required) (##core#quote #f)) (......
<eval> (##sys#list (##core#quote help) (##sys#list (##core#quote required) (##core#quote #f)) (##sys#list (......
<eval> (##sys#list (##core#quote required) (##core#quote #f))
<eval> (##sys#list (##core#quote value) (##core#quote #f))
<eval> (##sys#list (##core#quote single-char) (##core#quote #\h))
<eval> (##sys#list (##core#quote limit) (##sys#list (##core#quote required) (##core#quote #t)) (##sys#list ...
<eval> (##sys#list (##core#quote required) (##core#quote #t))
<eval> (##sys#list (##core#quote value) (##core#quote #f))
<eval> (##sys#list (##core#quote single-char) (##core#quote #\l))
<eval> (##sys#list (##core#quote value) (##sys#list (##core#quote required) (##core#quote INTEGER)) (##sys#......
<eval> (##sys#list (##core#quote required) (##core#quote INTEGER))
<eval> (##sys#list (##core#quote predicate) integer?)
<syntax> (getopt-long (quote (program-arguments)) grammar)
<syntax> (quote (program-arguments))
<syntax> (##core#quote (program-arguments))
<eval> (getopt-long (quote (program-arguments)) grammar) <--
任何想法?
答案 0 :(得分:1)
我找出了getopt-long时遇到的问题。您必须使用getopt-long
加载use
,如下所示:
(use getopt-long)
(define grammar
`((help (required #f)
(value #f)
(single-char #\h))
(limit (required #f)
(value #f) ;; optional value
(single-char #\l)
(value (required INTEGER)
(predicate ,integer?)))))
(getopt-long (argv) grammar)