Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (use-modules
- (ice-9 getopt-long))
- (define supported-props
- (alist->hash-table
- (map
- (lambda (k)
- (cons k #t))
- '(single-char value required? predicate))))
- (define (conform-props props)
- (fold-right
- (lambda (kv new-props)
- (if (hash-ref supported-props (car kv))
- (cons kv new-props)
- new-props))
- #nil
- props))
- (define (conform-spec spec)
- (map
- (lambda (kv)
- (cons
- (car kv)
- (conform-props (cdr kv))))
- spec))
- (define (getopt-long args options-spec)
- ((@ (ice-9 getopt-long) getopt-long)
- args (conform-spec options-spec)))
Add Comment
Please, Sign In to add comment