Embedding literal functions in macros "sorta" works. It behaves
glitchy sometimes, especially if the functions are closures.

If your set of functions is not open-ended, I'd suggest simply
defn'ing all of them at both client and server sides, sticking them in
a map, and putting a keyword instead of an actual function object in
your widget data. The keyword is used to look up the correct function
at both ends. If any function is a closure over run-time-variable
parameters, put the keyword and these parameters in the data, e.g.

(server)

(-> widget-data-map
  (assoc :my-fun the-function-itself)
  (assoc :my-fun-p1 42))

...

(client)

(let [f #((:my-fun widget-data-map) p1)]
  ...)

BTW, what did you mean by "I needed to hold
more metadata than a record definition allows"? AFAIK, records (and
metadata) are no more capacity-limited than are Clojure maps in
general, and I'm not sure those are even limited to the 2^31 entries
that are typically the maximum capacities of java.util collections.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to