Recursive implementation of the elem' function