Add drain-input.

* module/mes/guile.mes (drain-input): New function.
This commit is contained in:
Jan Nieuwenhuizen 2017-01-03 23:46:44 +01:00
parent cc68c1cda8
commit b8fd6ca7b9
1 changed files with 6 additions and 1 deletions

View File

@ -1,7 +1,7 @@
;;; -*-scheme-*-
;;; Mes --- Maxwell Equations of Software
;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016,2017 Jan Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of Mes.
;;;
@ -25,6 +25,11 @@
(define-macro (define-module module . rest) #t)
(define-macro (use-modules . rest) #t)
(define (drain-input port)
(let loop ((c (read-char)))
(if (eq? c #\*eof*) '()
(cons c (loop (read-char))))))
(define (make-string n . fill)
(list->string (apply make-list n fill)))