We discuss some of the analytic properties of lens space indices for 4d N = 2 theories of class S. The S-duality properties of these theories highly constrain the lens space indices, and imply in particular that they are naturally acted upon by a set of commuting difference operators corresponding to surface defects. We explicitly identify the difference operators to be a matrix-valued generalization of the elliptic Ruijsenaars-Schneider model. In a special limit these difference operators can be expressed naturally in terms of Cherednik operators appearing in the double affine Hecke algebras, with the eigenfunctions given by non-symmetric Macdonald polynomials. June 2013 J m (β) = J (x −m β) , (6.5) and then J m+1 (β) = J m (x −1 β) , J m−1 (β) = J m (xβ) . (6.6)