rewrite ``locateat`` function according to @timholy and using comprehension