tail-recursive implementations of nth element