In Scheme, the common scheme used to name functions with side effects
is to append an exclamation mark to the function name.  Obviously, the
types of ways in which Clojure abstracts state modifications are more
complicated and complete than Scheme, so maybe a function naming
scheme for Clojure functions could be useful.   Is there a naming
scheme already being used out there or proposals for one?  Here are a
few examples of idioms I have seen that could maybe use a naming
scheme:

1. Function that has a side effect:

(defn alpha [msg]
  (println msg))

2. Function that performs a transaction (and therefore has a side
effect):

(defn beta []
  (dosync (ref-set foo 10)))

3. Function that needs to be in a transaction:

(defn gamma []
  (ref-set bar 42))

--Kevin Albrecht
--~--~---------~--~----~------------~-------~--~----~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to