> P.S. Thanks everyone for your help so far. My brain is overheating but I am 
> learning a lot.

You're welcome.

To do what you're proposing you will probably need the emitted
function to look like:

(fn [& args]
  (let [foo (some logic goes here)
        bar (some logic goes here)
        ...]
    (body goes here)))

where the first logic checks the args for containing the value for
foo, if it does evaluates to that value, and if not evaluates to foo's
default; the second does likewise for bar; and so on.

Alternatively, if that might result in a lot of inefficient duplication,

(fn [& args]
  (let [argmap__5673__auto (#'some-ns/parse-args args)
        foo (or (:foo argmap__5673__auto) 42)
        bar (or (:bar argmap__5673__auto) nil)
        ...]
    (body goes here)))

where you define a private parse-args function in your namespace to
turn an argument seq into a map of argument name keywords to values,
with some omissions, and 42 and nil are the defaults which the macro
builds right into the function.

Of course, this has the slight issue that arguments whose values are
false or nil will be changed to their defaults. You may need some
trickier handling, e.g.

(let [...
      foo (:foo argmap__5673__auto)
      foo (if (:foo argmap__5673__auto) foo 42)
      ...]
  ...)

or

(let [...
      foo (find argmap__5673__auto :foo)
      foo (if foo (val foo) 42)
      ...]
  ...)

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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