From 14b6e310816d1d8105f0a099761b9ad9f6afbb9f Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Sun, 20 Mar 2022 16:40:50 -0400 Subject: [PATCH] Move prelude functions out to prelude ns --- src/ludus/prelude.clj | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/ludus/prelude.clj diff --git a/src/ludus/prelude.clj b/src/ludus/prelude.clj new file mode 100644 index 0000000..e59b2a6 --- /dev/null +++ b/src/ludus/prelude.clj @@ -0,0 +1,36 @@ +(ns ludus.prelude + (:require + [ludus.ast :as ast])) + +(def eq { + :name "eq" + ::ast/type ::ast/clj + :body = + }) + +(def add { + :name "add" + ::ast/type ::ast/clj + :body + + }) + +(def panic { + :name "panic" + ::ast/type ::ast/clj + :body (fn [& args] (throw (ex-info "Ludus panicked!" {:args args}))) + }) + +(def print { + :name "print" + ::ast/type ::ast/clj + :body (fn [& args] + (println (str args)) + :ok) + }) + +(def prelude { + "eq" eq + "add" add + "panic" panic + "print" print + }) \ No newline at end of file