The original text: ,---- | We define refs the same way we define atoms, but the two are used rather differently. | Let's take a quick look at how they work below. | | (def names (ref [])) | | (dosync | (ref-set names ["John"]) | (alter names #(if (not-empty %) | (conj % "Jane") %))) | | In this code, we define a ref called names, then open a transaction using the dosync statement. Inside the transaction we set names to a vector with the value "John". Next, we call alter to check if names is not empty and add "Jane" to the vector of the names if that's the case. | | Note that since this is happening inside a transaction, the check for emptiness depends on the existing state along with any state built up within the same transaction. If we tried to add or remove a name in a different transaction, it would have no visible effect on ours. In case of a collision, one of the transactions would end up being retried. `----
Then I use region select code from (def to ))), then press [C-c C-, s]. It has weird offset like this: ,---- | #+begin_src | (def names (ref [])) | | (dosync | (ref-set names ["John"]) | (alter names #(if (not-empty %) | (conj % "Jane") %))) | #+end_src `---- But when I region select by backward from ))) to (def, it works fine. no offset. -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3