Hi there,

I'm trying to create a fn which does the following:

* returns a fn which takes an arbitrary number of args
* calls a helper fn, passing the incoming args returning a vector of 
alternating symbols and vals
* creates a let form using the vector of alternating symbols and vals returned 
by the helper fn as the bindings
* contains some inner form that makes use of the bindings

i.e. is it possible to implement something that allows the following to work:

(defn binding-vec 
  [args]
  ['size (count args)])

(defn mk-dynamically-bound-fn
  [form]
  ;; returns a fn with sign [& args] which
  ;; uses binding-vec to create a the vec for
  ;; which a let statement binds around form
  )

(def a (mk-dynamically-bound-fn '(+ size 10)))

(a 1 2 3 4) ;=> 14 (the number of args + 10)


Please let me know if I'm being a bit crazy with the question. It's totally 
possible that I'm barking up the wrong tree with this line of enquiry.

Sam

---
http://sam.aaron.name

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