fp-style recursive while loop def while_block()if return elsereturn while_fp lambdaand while_block()or while_fp(while_fp(our translation of while still requires while_block(function that may itself contain statements rather than just expressions we could go further in turning suites into function sequencesusing map(as above if we did thiswe couldmoreoveralso return single ternary expression the details of this further purely functional refactoring is left to readers as an exercise (hintit will be uglyfun to play withbut not good production codeit is hard for to be useful with the usual testssuch as while myvar== since the loop body (by designcannot change any variable values one way to add more useful condition is to let while_block(return more interesting valueand compare that return value for termination condition here is concrete example of eliminating statementsimperative version of "echo()def echo_imp()while input("imp -"if ='quit'break elseprint(xecho_imp(now let' remove the while loop for the functional versionfp version of "echo()def identity_print( )"identity with side-effectprint(xreturn echo_fp lambdaidentity_print(input("fp -"))=='quitor echo_fp(echo_fp(eliminating loops