Move example-specific code into examples/.

There's no need to litter the main library with examples-specific helper code.