Add clj
fn to prelude, calls arbitrary Clojure.
This commit is contained in:
parent
c8c74fbd49
commit
a6ef6522c0
|
@ -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
|
||||
|
||||
")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
})
|
Loading…
Reference in New Issue
Block a user