Hi!
I have got
(def *g)
(def *g1)
(def *g2)
(def *g3)
(def *g4)
(def *g5)
(def *g6)
(defmacro grep[ pat in & body ]
`(do (when-let[ r# (re-matches (re-pattern ~pat) ~in) ]
(binding [ *g (first r#) *g1 (get r# 1) *g2 (get r# 2)
*g3 (get
r# 3)
*g4 (get r# 4) *g5 (get r# 5) *g6
(get r# 6) ]
~@body
))))
(grep "(.+)-(.+)" "1-4"
(println *g *g1 *g2)
)
I need to optimize the *gx so it won't look like hand written. Anyone?
I was trying to use with-bindings and #' but it doesn't work. Also
push and pop of thread bindings didn't want to work.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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