Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

repl: refactor, split into functions

  • Loading branch information...
commit 5edebe66d2e3a1c6aa7859193afe55231d41152a 1 parent 9f2b4ce
Kristian Lein-Mathisen authored
Showing with 23 additions and 20 deletions.
  1. +23 −20 sdcard/live-update.scm
43 sdcard/live-update.scm
View
@@ -16,28 +16,31 @@
(use tcp)
+
(define aip
- (let [(line-number 0)]
- (new-async-input-port
- i
- (lambda ()
- (set! line-number (fx+ 1 line-number))
- (display (conc "@" line-number "> ") o)
- (handle-exceptions
- exn
- (with-output-to-port o
- (lambda ()
- (print-error-message exn)
- (print-call-chain)) )
-
- (let [(sexp (read))]
- (logi (conc "eval: " sexp))
- (with-output-to-port o
+ (let* [(show-prompt
+ (let [(line-number 0)]
(lambda ()
- (with-error-output-to-port o
- (lambda ()
- (display (eval sexp))
- (write-char #\newline)))))))))))
+ (set! line-number (fx+ 1 line-number))
+ (display (conc "@" line-number "> ") o))))
+ (repl
+ (lambda ()
+ (handle-exceptions
+ exn
+ (with-output-to-port o
+ (lambda ()
+ (print-error-message exn)
+ (print-call-chain)))
+ (begin (show-prompt)
+ (let [(sexp (read))]
+ (logi (conc "eval: " sexp))
+ (with-output-to-port o
+ (lambda ()
+ (with-error-output-to-port o
+ (lambda ()
+ (display (eval sexp))
+ (write-char #\newline))))))))))]
+ (new-async-input-port i repl)))
(let [(c 0.2)]
(glClearColor c c c 1))
Please sign in to comment.
Something went wrong with that request. Please try again.