Created
October 12, 2009 21:16
-
-
Save boorad/208756 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final_key_lookup(Good, Bad, N, Const, ResolveFun, NotFoundFun, Access) -> | |
{NotFound, Reasons} = NotFoundFun(Bad, Const), | |
if | |
length(Good) >= Const -> {ok, ResolveFun(Good)}; | |
NotFound -> {ok, not_found, Reasons}; | |
true -> error_message(Good, Bad, N, Const, Access) | |
end. | |
% and | |
resolve_not_found(Bad, R) -> | |
{Count, Reasons} = lists:foldl(fun({Error,Reason}, {CountAcc,ReasonAcc}) -> | |
case Error of | |
not_found -> {CountAcc+1, [Reason|ReasonAcc]}; | |
_ -> {CountAcc, ReasonAcc} | |
end | |
end, {0, []}, Bad), | |
if | |
Count >= R -> {true, Reasons}; | |
true -> {false, Reasons} | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment