Discrete mechanics of arbitrary order