Changes between Version 13 and Version 14 of Clojure Client Tutorial


Ignore:
Timestamp:
Aug 3, 2011 1:30:06 PM (13 years ago)
Author:
kedwar10
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Clojure Client Tutorial

    v13 v14  
    3333* If you want to ensure tail cail optimization, use the "recur" function instead of using your function name.  "recur" also works with loops.
    3434* "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.
     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.
    3636* Atoms are your go-to way to manage state.
    3737* 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/].