Changes between Version 75 and Version 76 of Clojure Client Tutorial
- Timestamp:
- Aug 23, 2011 5:20:11 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Clojure Client Tutorial
v75 v76 38 38 39 39 Some advice for Clojure programming: 40 * Always strive forpure functions (as in no side effects). This is critical if you want to avoid refactoring your code later on.40 * Always try to write pure functions (as in no side effects). This is critical if you want to avoid refactoring your code later on. 41 41 * For tracing functions, use [http://richhickey.github.com/clojure-contrib/trace-api.html]. 42 42 * :pre and :post conditions can be used to put constraints on functions. Here is an example [http://blog.fogus.me/2009/12/21/clojures-pre-and-post]. … … 46 46 * If you want to ensure tail-call optimization, use the "recur" function instead of using your function name. "recur" also works with loops. 47 47 * "Weird" error messages usually result from forgetting to specify the arguments during a function definition or from mismatched parenthesis. 48 * You can often replace global data structures or variables (or classes) with closures. 48 49 * Atoms are your go-to way to manage state. (Don't ignore the other types however, as choosing the inappropriate type can force a refactoring later on.) 49 50 * The function that you pass as an argument to "swap!" (the function that updates an atom) must be pure. This is because the update to the atom is retriable so it may get called more then once.