Changes between Version 75 and Version 76 of Clojure Client Tutorial


Ignore:
Timestamp:
Aug 23, 2011 5:20:11 PM (13 years ago)
Author:
kedwar10
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Clojure Client Tutorial

    v75 v76  
    3838
    3939Some advice for Clojure programming:
    40 * Always strive for pure 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. 
    4141* For tracing functions, use [http://richhickey.github.com/clojure-contrib/trace-api.html].
    4242* :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].
     
    4646* If you want to ensure tail-call optimization, use the "recur" function instead of using your function name.  "recur" also works with loops.
    4747* "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.
    4849* 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.)
    4950* 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.