On finitely recursive programs