-
-
Save arohner/ed2a1de1af8dc047c5f6 to your computer and use it in GitHub Desktop.
callable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn resolve-var-str [s] | |
(let [[_ ns v] (re-find #"#'([^/]+)/(.+)" s)] | |
(ns-resolve (symbol ns) (symbol v)))) | |
(defn call* [pfn] | |
(let [v (-> pfn :v resolve-var-str)] | |
(apply v (-> pfn :args)))) | |
(defrecord SerializableFn [v args] | |
clojure.lang.IFn | |
(invoke [this] | |
(call* this)) | |
(call [this] ;; j.u.c.Concurrent | |
(call* this)) | |
(run [this] ;; j.l.Runnable | |
(call* this))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment