In this question, I asked about a reference for translating imperative code to functional code. I want to ask a more specific question here.
How, in general, do we translate into functional style, a statement of the form:
if (cond) then
do x;
else
do y;
I know that functional languages have if-then-else statements but the expressions are only allowed to be pure. Is there a general way of doing this translation?
do x
anddo y
first. – vonbrand Mar 03 '20 at 02:30