Blending-function techniques with applications to discrete least squares