Text this: Consistency of the $k$-nearest neighbors rule for functional data