From 272951a4118b7bffa2913f48f7c154ff003dda0b Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Sun, 20 Mar 2022 19:35:29 -0400 Subject: [PATCH] Add several functions to the prelude --- src/ludus/prelude.clj | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/src/ludus/prelude.clj b/src/ludus/prelude.clj index cb9e45b..74bbe3d 100644 --- a/src/ludus/prelude.clj +++ b/src/ludus/prelude.clj @@ -10,9 +10,33 @@ ::data/type ::data/clj :body +}) -(def panic {:name "panic" - ::data/type ::data/clj - :body (fn [& args] (throw (ex-info "Ludus panicked!" {:args args})))}) +(def sub {:name "sub" + ::data/type ::data/clj + :body -}) + +(def mult {:name "mult" + ::data/type ::data/clj + :body *}) + +(def div {:name "div" + ::data/type ::data/clj + :body /}) + +(def inc {:name "inc" + ::data/type ::data/clj + :body inc}) + +(def dec {:name "dec" + ::data/type ::data/clj + :body dec}) + +(def ld-not {:name "not" + ::data/type ::data/clj + :body not}) + +(def panic! {:name "panic!" + ::data/type ::data/clj + :body (fn [& args] (throw (ex-info "Ludus panicked!" {:args args})))}) (def print {:name "print" ::data/type ::data/clj @@ -22,5 +46,11 @@ (def prelude {"eq" eq "add" add - "panic" panic - "print" print}) \ No newline at end of file + "panic!" panic! + "print" print + "sub" sub + "mult" mult + "div" div + "inc" inc + "dec" dec + "not" not}) \ No newline at end of file