Add clj
fn to prelude, calls arbitrary Clojure.
This commit is contained in:
parent
c8c74fbd49
commit
a6ef6522c0
|
@ -963,11 +963,7 @@
|
||||||
|
|
||||||
(do
|
(do
|
||||||
(def source "
|
(def source "
|
||||||
let x = (1, 2)
|
|
||||||
when x is {
|
|
||||||
(y, 2) if eq (y, 1) -> :onetwo
|
|
||||||
_ -> :not_x
|
|
||||||
}
|
|
||||||
")
|
")
|
||||||
|
|
||||||
(println "")
|
(println "")
|
||||||
|
@ -985,17 +981,3 @@
|
||||||
(println result)
|
(println result)
|
||||||
result))
|
result))
|
||||||
|
|
||||||
(comment "
|
|
||||||
|
|
||||||
Left to do:
|
|
||||||
* improve panics
|
|
||||||
* add location info for panics
|
|
||||||
* refactor calling keywords
|
|
||||||
* refactor accessing structs vs. hashes
|
|
||||||
|
|
||||||
")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,18 @@
|
||||||
::data/type ::data/clj
|
::data/type ::data/clj
|
||||||
:body get-type})
|
: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 {
|
(def prelude {
|
||||||
"id" id
|
"id" id
|
||||||
"foo" :foo
|
"foo" :foo
|
||||||
|
@ -159,4 +171,5 @@
|
||||||
"get" get-
|
"get" get-
|
||||||
"draw" draw
|
"draw" draw
|
||||||
"type" type-
|
"type" type-
|
||||||
|
"clj" clj
|
||||||
})
|
})
|
Loading…
Reference in New Issue
Block a user