General-purpose, custom functions that might be used in several sections, appear here
(define (print item . rest)
(let ((all-item (cons item rest)))
(for-each
(lambda (item) (display item) (display " "))
all-item))
(newline))
(use-modules (ice-9 popen) (srfi srfi-1) (srfi srfi-13))
(define (drain-output port)
(let loop ((chars '())
(next (read-char port)))
(if (eof-object? next)
(list->string (reverse! (cdr chars)))
(loop (cons next chars)
(read-char port)))))
(define (qx pipeline)
(let* ((pipe (open-input-pipe pipeline))
(output (drain-output pipe)))
(close-pipe pipe)
output))
|