Changes between Version 14 and Version 15 of Clojure Client Tutorial
- Timestamp:
- Aug 3, 2011 1:31:46 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Clojure Client Tutorial
v14 v15 33 33 * If you want to ensure tail cail optimization, use the "recur" function instead of using your function name. "recur" also works with loops. 34 34 * "Weird" error messages usually result from forgetting to specify the arguments during a function definition or from mismatched parenthesis. 35 * The function that you pass as an argument to swap! must be pure (as in no side effects). This is because the update to the atom is retriable so it may get called more then once. Also, the function must accept one argument, so use the form (fn [prev] <your code here>); the form #(...) that doesn't have a "%1" in it will throw an illegal argument exception.35 * The function that you pass as an argument to swap! must be pure (as in no side effects). This is because the update to the atom is retriable so it may get called more then once. 36 36 * Atoms are your go-to way to manage state. 37 37 * If you must define a type, prefer the simplest option. A decision flowchart: [http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/].