1 (defun load-relative (file)
2 (let* ((current-file (or load-file-name buffer-file-name
))
3 (current-file-directory (file-name-directory current-file
)))
4 (load (expand-file-name file current-file-directory
) nil t
)))
6 (load-relative "types.el")
7 (load-relative "reader.el")
8 (load-relative "printer.el")
20 (PRINT (EVAL (READ input
))))
22 (defun readln (prompt)
23 ;; C-d throws an error
24 (ignore-errors (read-from-minibuffer prompt
)))
26 (defun println (format-string &rest args
)
29 (princ (apply 'format format-string args
)))
35 (let ((input (readln "user> ")))
40 ;; empty input, carry on
42 (unterminated-sequence
43 (let* ((type (cadr err
))
46 ((eq type
'string
) ?
\")
48 ((eq type
'vector
) ?\
])
49 ((eq type
'map
) ?
}))))
50 (princ (format "Expected '%c', got EOF\n" end
))))
52 (println (error-message-string err
))
55 ;; print final newline