Move prelude functions out to prelude ns

This commit is contained in:
Scott Richmond 2022-03-20 16:40:50 -04:00
parent 1d9559402c
commit 14b6e31081

36
src/ludus/prelude.clj Normal file
View File

@ -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
})