j : straightforward translation of a python snippet