Fix bug in anonymous function example

The name and the rest of the function suggest that `mid` is supposed to be half the length, not the parity of the length, of the string.