import (picrin readline) only when exists

This commit is contained in:
Yuichi Nishiwaki 2014-08-31 01:41:12 +09:00
parent ac15ac6e2d
commit 96a90810af
1 changed files with 17 additions and 2 deletions

View File

@ -3,8 +3,23 @@
(scheme read)
(scheme write)
(scheme eval)
(picrin readline)
(picrin readline history))
(picrin macro)
(picrin library))
(define-syntax define-readline
(er-macro-transformer
(lambda (form rename compare)
(if (member '(picrin readline) (libraries))
`(import (picrin readline)
(picrin readline history))
`(begin
(define (readline str)
(display str)
(read-line))
(define (add-history str)
#f))))))
(define-readline)
(define (repl)
(let ((line (readline "> ")))