;; Utility function to process the main arguments into options and other ;; using a given template ; The input arguments (less options (constant 'ARGS (1 (main-args))) ; The command line options replaced with actuals, in order. (constant 'OPTIONS (map (fn (O) (if (collect (if (match (flat (list '* O '*)) ARGS) (let ((A ($it 0)) (B ($it -1)) (C (slice $it 1 (- (length $it) 2)))) (constant 'ARGS (append A B)) C))) (cons O $it))) OPTIONS))