Hi! I have found two issues which stops me from using function
serializations.
(ns code.serialfn
(:refer-clojure :exclude (fn)))
(defn- save-env [env form]
(if env
`(let ~(vec (apply concat (for [[name local] env]
[name (.eval (.init local))])))
(~...@form))
form))
(defmacro fn [& sigs]
`(with-meta (clojure.core/fn ~...@sigs)
{:type ::serializable-fn
::source (quote ~(save-env &env &form))}))
(defmethod print-method ::serializable-fn [o ^Writer w]
(print-method (::source (meta o)) w))
; here are some examples
; gives null pointer
(prn-str { :kozak (fn [z]
[z (fn ([] (println "abc")) ([a] (println a))) ]) })
; gives can't eval locals - unsupported operation
(defn pipe
([] (pipe java.util.Collections/EMPTY_LIST))
([col]
(let [q (java.util.concurrent.LinkedBlockingQueue. col)]
[(take-while #(not (= % q)) (repeatedly #(.take q) ))
(fn ([e] (.put q e))
([] (.put q q)))])))
any help?
thanks
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en