picrin/contrib/30.readline/example/simple-repl.scm

16 lines
408 B
Scheme
Raw Normal View History

2014-08-09 02:09:21 -04:00
(import (scheme base)
(scheme read)
(scheme eval)
(scheme write)
(picrin readline)
(picrin readline history))
(let loop ((n 1))
(let ((input (readline "> ")))
(if (eof-object? input)
(newline)
(begin
(add-history input)
(write (eval (read (open-input-string input)) '(picrin user)))
(newline)
(loop 1)))))