There are a couple of mistakes in this section.
-
In the first example of a pure function
f(x) = <raise power="2">x</raise>
I believe the intention was for the “2” to be rendered as superscript to “x”, but somehow the markup passed through unprocessed in both PDF and ePub formats. (No idea how this was typeset in the print book, as I only have the e-books.) -
In the second example of a pure function, the post-increment in
return counter++;
is wrong; the statement, as written, returns the original value ofcounter
. It seems to me the example is trying to be too clever for its own good and instead of pre-increment (which would also be technically correct), it should really be written as
return counter + 1;
for clarity. -
With the second example corrected, it would perhaps be advisable to also update the third example to use
counter = counter + 1;
to maintain symmetry with the second example (though, both post- and pre-increment versions would also be technically correct in this case).
I realize this is quite an old book, so not sure about the likelihood of a second edition (where these could be corrected).