built-ins: read: Port to Mes.
* gash/built-ins/read.scm (define-module): Import SRFI 14. (right-pad): New procedure. (main): Use it in place of a 'circular-list' trick.
This commit is contained in:
parent
7d713e0435
commit
88dfac30c3
|
@ -23,6 +23,7 @@
|
|||
#:use-module (gash environment)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-14)
|
||||
#:use-module (srfi srfi-26))
|
||||
|
||||
;;; Commentary:
|
||||
|
@ -84,6 +85,12 @@ field, while contiguous sequences of characters from the set
|
|||
(reverse! (cons field acc)))))))))
|
||||
(else '())))
|
||||
|
||||
(define (right-pad lst n)
|
||||
(let ((m (length lst)))
|
||||
(if (< m n)
|
||||
(append lst (make-list (- n m) ""))
|
||||
lst)))
|
||||
|
||||
(define (main . args)
|
||||
(match-let* (((vars . get-line)
|
||||
(match args
|
||||
|
@ -102,7 +109,7 @@ field, while contiguous sequences of characters from the set
|
|||
;; XXX: Verify that VAR is a valid variable name.
|
||||
(setvar! var field))
|
||||
vars
|
||||
(append fields (circular-list "")))
|
||||
(right-pad fields (length vars)))
|
||||
(if (eof-object? delimiter)
|
||||
EXIT_FAILURE
|
||||
EXIT_SUCCESS)))
|
||||
|
|
Loading…
Reference in New Issue