Current section
Files
Jump to
Current section
Files
src/fp_gl@chain_rec.erl
-module(fp_gl@chain_rec).
-compile(no_auto_import).
-export([tail_rec/2]).
-spec tail_rec(ELN, fun((ELN) -> {ok, ELO} | {error, ELN})) -> ELO.
tail_rec(Start_with, F) ->
Ab = F(Start_with),
case Ab of
{error, E} ->
tail_rec(E, F);
{ok, B} ->
B
end.