Thanks so much for all the replies, that showed the way to what I
wanted (simplified example using substring):

(defn lazy-self [me]
  ((fn rfib [a] (lazy-cons a (rfib a))) me))
(defmacro map-obj [jobj jmeth argbinds & colls]
  `(map (memfn ~jmeth [EMAIL PROTECTED]) (lazy-self ~jobj) [EMAIL PROTECTED]))

(map-obj "Timothy" substring (i j) (iterate inc 0) [3 5 4])

=> ("Tim" "imot" "mo")

ie: I was able to create a macro map-obj which will take a java object
and map a method to a given binding+input collection

Just a few follow on questions...
1) Is there any way to do away with the input bindings altogether? map
doesn't need input bindings, but memfn does. I don't quite grasp why
they are needed for memfn, or how to construct an input binding based
on the number of collections. ie: I would need to generate a list of
symbols the size of the number of collections (map gensym colls) ????
I know that code wont work, but there must be a way.
2) Is there a better way than my creation of a lazy-self function, or
is this pretty much the right thing to do?
3) Would I be better off making a macro that expands into a (doto
statement?


Regards,
Tim.
--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to