I'm trying to find an algorithm on writing a high-level function - that doesn't have to halt - in Python (or Pseudo Code) that for a given list of functions [f1,...,fn] and a given list of inputs [x1,...,xn] prints fi(xj) (meaning all the pairs of functions and inputs) only once.
Of course the naive suggestion of implementing this would be:
for f in lst1:
for x in lst2:
f(x)
But the catch is that some of functions may loop forever on some inputs.
I am allowed to use a stepper (which has a step() method that makes one subsequent computation step of the function each time called)
I just need an idea or an algorithm on how to do so.