> What macros do y'all have that you want to "apply" things to?

I am using structs and functions for workings with these structs.

Just some very general example:

(defstruct department :name :head :members-l1 :members-l2 ...)

(defn process-department [department-struct]
  (reduce + (list
                    (* members-l1-fee (:members-l1 department-
struct))
                    (* members-l2-fee....)))

The number of "payment levels" are not the same for every "company",
so I thought of creating these structs and functions by macros.
Because they all have the same arguments these calls are wrapped in a
function:

(defn init-funs [name & levels]
   (do
    (apply-macro create-department-struct name levels)
    (apply-macro create-process-department name levels)
    nil))

A call like
(init-funs "company1" "level1" "level2")
will result in
(defstruct company1-department :name :head :level1 :level2)
and so on.

So I need macros for the benefit of individual strucs and functions
for every "company", and I need something like apply to pass
parameters from the inital function to the macros. This is working by
using (eval (apply-macro... as described in a previous posting in this
thread. It would be nice to have a solution without eval. But maybe my
attempt of writing code that writes code is too enthusiastic.
--~--~---------~--~----~------------~-------~--~----~
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