On self-affine functions