In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "The previously defined probability
function requires a single argument to represent the attribute or condition whose probability of occurrence we wish to calculate."
A block of code is set as follows:
(defn predict [coefs X] {:pre [(= (count coefs) (+ 1 (count X)))]} (let [X-with-1 (conj X 1) products (map * coefs X-with-1)] (reduce + products)))
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
:dependencies [[org.clojure/clojure "1.5.1"]
[incanter "1.5.2"]
[clatrix "0.3.0"]
[net.mikera/core.matrix "0.10.0"]]
Any command-line input or output is written as follows:
$ lein deps
Another simple convention that we use is to always show the Clojure code that's entered in the REPL (read-eval-print-loop) starting with the user>
prompt. In practice, this prompt will change depending on the Clojure namespace that we are currently using. However, for simplicity, REPL code starts with the user>
prompt, as follows:
user> (every? #(< % 0.0001) (map - ols-linear-model-coefs (:coefs iris-linear-model)) true
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".