(this is not a question about recur)

Suppose I have:

(defn v1
  ([x]   (v1 x []))
  ([x r] (conj r x)))

and I decide to make v2 - for whatever reason - say I think I have a better 
implementation for part of it

so I start with a copy and edit:

(defn v2
  ([x]   (v1 x []))
  ([x r] (conj r (inc x))))

I sometimes find that I forget to update v1 to v2 (as above). This less 
visible in more complex functions.


So questions: 

1. would it be, or is it possible to have something generic like this?

(defn v1
  ([x]   (*call-self* x []))
  ([x r] (conj r x)))

where call-self is some suitable generic pseudonym for calling the 
enclosing function in this case v1.

in this case, v2:

(defn v2
  ([x]   (*call-self* x []))
  ([x r] (conj r (inc x)))



2. What about anonymous fns?

(fn ([x] (call-self x 0)) ([x y] ...)))



Thanks

Dave




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