Sure. Here's two plausible examples. I apologize for not providing any
unit tests. I'm not quite sure what they are. I've never written one
before.
;-----------EXAMPLE 1---------
(defblockfn surround_with_text [text block]
(println text)
(block)
(println text))
(surround_with_text "surrounding text"
(println "this is surrounded with text")
(println "this is also surrounded with text"))
;-------EXAMPLE 2-----------
(def *gravity*)
(defblockfn with_gravity [gravity block]
(binding [*gravity* gravity]
(block)))
(with_gravity 9.81
(println "current gravity is:" *gravity*))
-Patrick
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---