equal
deleted
inserted
replaced
17 |
17 |
18 The most important concept in this module are strings. Strings |
18 The most important concept in this module are strings. Strings |
19 are composed of \defn{characters}. While characters are surely |
19 are composed of \defn{characters}. While characters are surely |
20 a familiar concept, we will make one subtle distinction in |
20 a familiar concept, we will make one subtle distinction in |
21 this module. If we want to refer to concrete characters, like |
21 this module. If we want to refer to concrete characters, like |
22 \code{a}, \code{b} and so on, we use a typewriter font. |
22 \code{a}, \code{b}, \code{c} and so on, we use a typewriter font. |
23 Accordingly if we want to refer to the concrete characters of |
23 Accordingly if we want to refer to the concrete characters of |
24 my email address we shall write |
24 my email address we shall write |
25 |
25 |
26 \begin{center} |
26 \begin{center} |
27 \pcode{christian.urban@kcl.ac.uk} |
27 \pcode{christian.urban@kcl.ac.uk} |
35 \end{center} |
35 \end{center} |
36 |
36 |
37 |
37 |
38 \noindent But often we do not care which particular characters |
38 \noindent But often we do not care which particular characters |
39 we use. In such cases we use the italic font and write $a$, |
39 we use. In such cases we use the italic font and write $a$, |
40 $b$ and so on for characters. Therefore if we need a |
40 $b$, $c$ and so on for characters. Therefore if we need a |
41 representative string, we might write |
41 representative string, we might write |
42 |
42 |
43 \begin{equation}\label{abracadabra} |
43 \begin{equation}\label{abracadabra} |
44 abracadabra |
44 abracadabra |
45 \end{equation} |
45 \end{equation} |
65 double quotes indicate that we are dealing with a string. But |
65 double quotes indicate that we are dealing with a string. But |
66 since we regard strings as lists of characters we could also |
66 since we regard strings as lists of characters we could also |
67 write this string as |
67 write this string as |
68 |
68 |
69 \[ |
69 \[ |
70 [\text{\it h, e, l, l, o}] |
70 [\text{\it h, e, l, l, o}] \;\;\text{or simply}\;\; \textit{hello} |
71 \] |
71 \] |
72 |
72 |
73 \noindent The important point is that we can always decompose |
73 \noindent The important point is that we can always decompose |
74 such strings. For example, we will often consider the first |
74 such strings. For example, we will often consider the first |
75 character of a string, say $h$, and the ``rest'' of a string |
75 character of a string, say $h$, and the ``rest'' of a string |