anchor.diff:  
   === Chain computations
   
  -Here's how you use that promise:
  -
  -[source, clojure]
  -----
  -(-> (p/promise 1)
  -    (p/then (fn [v] (inc v)))
  -----
  -
  -The `then` function takes one argument: a callback that will be called when the promise
  -is successfully resolved.
  -
  -But `then` is not the end, it also returns a promise that will be resolved or rejected
  -depending on return value of the first chain callback. That will allow you to compose
  -async computations in an easy way.
  -
  -[source, clojure]
  -----
  -(-> (p/promise 1)
  -    (p/then (fn [v] (inc v)))
  -    (p/then (fn [v] (* v 2))))
  -----
  +It there different ways to compose/chain computations using promises. We will start
  +with the basic: lineal way of chaining computations.
  +
  +That can be done using `then` or `chain` functions exposed in `promissum.core`
  +namespace. Bot them are mainly interchangeable. The main differencia is that
  +`chain` is variadic and `then` not.
  +
  +[source, clojure]
  +----
  +(def pr (-> (p/promise 2)
  +            (p/then inc)
  +            (p/then inc)))
  +
  +(p/then pr (fn [v]
  +             (println v)))
  +;; => Stdout: 4
  +----
  +
  +And here the same example using the `chain` function instead of `then`:
  +
  +[source, clojure]
  +----
  +(def pr (p/chain (p/promise 2) inc inc))
  +
  +(p/then pr (fn [v]
  +             (println v)))
  +;; => Stdout: 4
  +----
  +
  +Later, thanks to the link:https://github.com/funcool/cats[cats] library, it there
  +other few methods of create promise compositions in more powerfull way: `mlet`
  +and `alet` macros.
  +
  +For demostration purposes, imagine you have this function that emulates async
  +operation and return a promise:
  +
  +[source, clojure]
  +----
  +(require '[cats.core :as m])
  +(require '[promissum.core :as p])
  +
  +(defn sleep-promise
  +  [wait]
  +  (p/promise (fn [deliver]
  +               (js/setTimeout #(deliver wait) wait))))
  +----
  +
  +Now, we will try to use this function together with `mlet` macro and additionally
  +messure the execution time:
  +
  +[source, clojure]
  +----
  +(def pr
  +  (m/mlet [x (sleep-promise 42)
  +           y (sleep-promise 41)]
  +    (+ x y)))
  +
  +(p/then pr (fn [v]
  +             (println v)))
  +
  +;; This will take aprox: 83-85 msecs
  +;; => Stdout: 83
  +----
  +
  +The `mlet` bindings are executed sequentially, waiting in each step for promise
  +resolution. If an error occurs in some step, the entire composition will be
  +short-circuited, returing exceptionally resolved promise. This is very similar
  +to the up coming link:http://jakearchibald.com/2014/es7-async-functions/[ES7 async/await], but built in a generic way and as a library and not language feature.
  +
  +The main disadvantage of `mlet` is that it's evaluation model is strictly
  +secuential. It is ok for some use cases, when the sequential order is mandatory.
  +But, if the strictly secuential model is not mandatory, `mlet` does not take
  +the advantage of concurrency.
  +
  +For solve this problem, it there `alet` macro. It is almost identical to `mlet`
  +from the user experience but internally it is based in very different abstractions.
  +
  +Now, we will try to do the same example but using the `alet` macro:
  +
  +[source, clojure]
  +----
  +(def pr
  +  (m/alet [x (sleep-promise 42)
  +           y (sleep-promise 41)]
  +    (+ x y)))
  +
  +(p/then pr (fn [v]
  +             (println v)))
  +
  +;; This will take aprox: 41-45 msecs
  +;; => Stdout: 83
  +----
  +
  +We can observe that it returns the same result as in previous example,
  +but takes almost the half of time to finish execute all the computations. This
  +is happens because `alet` is more smarter macro and calculates de dependencies
  +between declared bindings and executes them in batches.
  +
  +You can read more about that link:http://funcool.github.io/cats/latest/#syntax-sugar[here].
   
   
   === Error handling
   
  -Until now, we have seen resolved promises, but what happens when an error occurs?
  +One of the advantages of using promise abstraction is that it natively has
  +a notion of error, so you don't need reinvent it. If some of the computations
  +of the composed promise chain/pipeline raises an exception, that one is
  +automatically propagated to the last promise making the effect of short-circuiting.
  +
  +Let see an example:
   
   [source, clojure]
   ----
  
positive.code:                (.log js/console error))))
  ----
  
  The `catch` function adds a new handler to the promise chain that will be called when
  any of the previous promises in the chain are rejected or an exception is raised.
  
  
  === Sequences
  
  Creating the sequence:
  
  [source, clojure]
  ----
  (require '[cats.core :as m])
  
  (let [p (m/>>= (do-something-first)
                 do-something-second
                 do-something-third)]
    (p/then p (fn [result]
                (.log js/console "Result: " result))))
  ----
  
  The standard promise library and JavaScript do not offer a standard way of chaining
  promises in sequence in that situation we use the _cats_ library `>>=` function.
  
  The _cats_ library offers monad abstractions and helpers to work with them, but do not
  worry, you don't need to understand anything related to monads. Just use the `>>=`
  function as a helper to chain together a sequence of promises.
  
  
  === Parallelism
  
  JavaScript environments like browsers or nodejs are pretty good at parallelizing IO
  operations like downloading content, using ajax or reading a file in nodejs.
  
  [source, clojure]
  ----
  (let [p (p/all [(do-some-io)
                  (do-some-other-io)])]
    (p/then p (fn [array-of-results]
                (do-something-with-results array-of-results))))
  ----
  
  There is another helper that allows you to unroll arguments when working with multiple
  promises:
  
  [source, clojure]
  ----
  (let [p (p/all [(do-some-io)
                  (do-some-other-io)])]
    (p/spread p (fn [result1 result2]
                  (do-stuff-with result1 result2))))
  ----
  
  The `spread` function works like the `then` function, with a unique difference being that
  it unrolls the received array of promises as positional arguments to the handler
  callback.
  
  
  === Delays and timeouts.
  
  JavaScript due its nature, does not allow you to block or sleep. But with promises you
  can emulate the functionality using `delay` like so:
  
  [source, clojure]
  ----
  (-> (p/delay 1000 "foobar")
      (p/then (fn [v]
                (.log js/console "Received:" v))))
  
  ;; After 1 second it will print the message
  ;; to the console: "Received: foobar"
  ----
  
  The promise library offers the ability to add a timeout to async operations thanks
  to the `timeout` function:
  
  [source, clojure]
  ----
  (-> (some-async-task)
      (p/timeout 200)
      (p/then #(.log js/console "Task finished"))
      (p/catch #(.log js/console "Timeout")))
  ----
  
  In case the async task is slow, in the example more that 200ms, the promise will be
  rejected with timeout error and successfully captured with the `catch` handler.
  
  
  === Choice
  
  You also can choose the first `n` number of promises to be fulfilled before moving on by
  using the `some` function:
  
  [source, clojure]
  ----
  (let [p (p/some 2 [(p/delay 100 1)
                     (p/delay 200 2)
                     (p/delay 120 3)])]
    (p/spread p (fn [x y]
                  (.log js/console "The first two finished: " x y))))
  ----
  
  There is a helper function called `any` that works very similar to `some` with
  `1` as the first argument. It returns a promise that will be fulfilled with one value
  instead of an array with the length of 1.
  
  [source, clojure]
  ----
  
negative.code: ----
  
  
  Later, for more advanced use cases, _promesa_ is an algebraic structure that
  implements the associative binary operation usually called `mappend`:
  
  [source, clojure]
  ----
  (require '[cats.core :as m])
  
  (def pr (m/mappend (p/promise {:a 1})
                     (p/promise {:b 2})))
  (p/then pr (fn [v]
               (println v)))
  
  ;; => Stdout: {:a 1 :b 2}
  ----
  
  
  === Delays and timeouts.
  
  JavaScript due its nature, does not allow you to block or sleep. But with promises
  you can emulate the functionality using `delay` like so:
  
  [source, clojure]
  ----
  (-> (p/delay 1000 "foobar")
      (p/then (fn [v]
                (.log js/console "Received:" v))))
  
  ;; After 1 second it will print the message
  ;; to the console: "Received: foobar"
  ----
  
  The promise library offers the ability to add a timeout to async operations thanks
  to the `timeout` function:
  
  [source, clojure]
  ----
  (-> (some-async-task)
      (p/timeout 200)
      (p/then #(.log js/console "Task finished"))
      (p/catch #(.log js/console "Timeout")))
  ----
  
  In case the async task is slow, in the example more that 200ms, the promise will be
  rejected with timeout error and successfully captured with the `catch` handler.
  
  
  === Sugar syntax
  
  Promises are one of the most used primitives for the composition of async functions.
  However, using promises _as is_ doesn't save you from callback hell.
  
  
  Let's see how we cam use similar syntactic sugar in ClojureScript:
  
  