The integrable dynamics of discrete curves