[Solved] How to simplify this Fortran function?
It is possible to write this using recursion. Note that count_present(p_1, p_2, …, p_n, p_{n+1}) returns the value count_present(p_1, p_2, …, p_n) unless all p_1, …, p_{n+1} are present and .TRUE.. In this latter case the result is n+1. count_present(p_1) returns 1 if p_1 is .TRUE., 0 otherwise. recursive function count_present(p1, p2, p3, p4, p5, … Read more