diff --git a/src/ludus/interpreter.clj b/src/ludus/interpreter.clj index 4ccdfc9..4bca9da 100644 --- a/src/ludus/interpreter.clj +++ b/src/ludus/interpreter.clj @@ -963,11 +963,7 @@ (do (def source " - let x = (1, 2) - when x is { - (y, 2) if eq (y, 1) -> :onetwo - _ -> :not_x - } + ") (println "") @@ -985,17 +981,3 @@ (println result) result)) -(comment " - - Left to do: - * improve panics - * add location info for panics - * refactor calling keywords - * refactor accessing structs vs. hashes - - ") - - - - - diff --git a/src/ludus/prelude.clj b/src/ludus/prelude.clj index 26aea38..bf10de1 100644 --- a/src/ludus/prelude.clj +++ b/src/ludus/prelude.clj @@ -135,6 +135,18 @@ ::data/type ::data/clj :body get-type}) +(defn strpart [kw] (->> kw str rest (apply str))) + +(def clj {:name "clj" + ::data/type ::data/clj + :body (fn [& args] + (println "Args passed: " args) + (let [called (-> args first strpart read-string eval) + fn-args (rest args)] + (println "Fn: " called) + (println "Args: " fn-args) + (apply called fn-args)))}) + (def prelude { "id" id "foo" :foo @@ -159,4 +171,5 @@ "get" get- "draw" draw "type" type- + "clj" clj }) \ No newline at end of file