refining the examples
This commit is contained in:
parent
d34374858d
commit
bc78a0a892
|
@ -1,15 +1,19 @@
|
||||||
|
(define send-message
|
||||||
|
(lambda (ptr-to-message length-of-message)
|
||||||
|
(asm
|
||||||
|
(li64 r1 3)
|
||||||
|
(li64 r2 1)
|
||||||
|
(li64 r3 ptr-to-message)
|
||||||
|
(li64 r4 length-of-message)
|
||||||
|
(eca))))
|
||||||
|
|
||||||
(define log
|
(define log
|
||||||
(lambda (level message)
|
(lambda (level string)
|
||||||
(
|
(
|
||||||
(append (message level))
|
(append (string level))
|
||||||
(define ptr-to-message (ptr-to message))
|
(define ptr-to-message (ptr-to string))
|
||||||
(define length-of-message (length message))
|
(define length-of-message (length string))
|
||||||
(asm
|
(send-message ptr-to-message length-of-message))))
|
||||||
(li64 r1 3)
|
|
||||||
(li64 r2 1)
|
|
||||||
(li64 r3 ptr-to-message)
|
|
||||||
(li64 r4 length-of-message)
|
|
||||||
(eca)))))
|
|
||||||
|
|
||||||
(define error (lambda (message) (log 0 message)))
|
(define error (lambda (message) (log 0 message)))
|
||||||
(define warn (lambda (message) (log 1 message)))
|
(define warn (lambda (message) (log 1 message)))
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
|
(define println
|
||||||
|
(lambda (s)
|
||||||
|
(print
|
||||||
|
(append s "\n"))))
|
||||||
|
|
||||||
(define repl
|
(define repl
|
||||||
(lambda () (
|
(lambda () (
|
||||||
(print "λ -> ")
|
(print "λ -> ")
|
||||||
(print
|
(println
|
||||||
(eval
|
(append
|
||||||
(read)))
|
("val -> "
|
||||||
(print "\n")
|
(eval (read)))))
|
||||||
(repl))))
|
(repl))))
|
||||||
(repl)
|
(repl)
|
||||||
|
|
Loading…
Reference in a new issue