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.
Use abbreviated syntax in anonymous function example
Merge pull request #1055 from lucaswerkmeister/fixSpecSampleBug

Fix bug in anonymous function example