use of function class and functor arithmetic for generating distance functions
examples and readme updated