Files
rust-mal/core/core.mal
teo3300 cf08b7e65a Fixing read-str
Previously the interactive mode looped on a READ fail
Now inner READ errors are treated as unrecoverable and cause the reader
to reset

Signed-off-by: teo3300 <matteo.rogora@live.it>
2024-01-17 13:11:52 +09:00

18 lines
352 B
Plaintext

;; Previously in core.rs
(def! not (fn* [x]
(if x nil true)))
(def! empty? (fn* [l]
(= (count l) 0)))
;; File-interaction functions
(def! load-file (fn* [f]
(eval (read-string (str "(do\n" (slurp f) "\nnil)")))))
(def! conf-reload (fn* []
(load-file (str MAL_HOME "/" "config.mal"))))
;; Shorthand
(def! quit (fn* []
(exit 0)))