mirror of
https://github.com/correl/riichi.git
synced 2024-11-23 19:19:55 +00:00
17 lines
291 B
Erlang
17 lines
291 B
Erlang
-module(lazy).
|
|
|
|
-export([find/2]).
|
|
|
|
-include("lazy.hrl").
|
|
|
|
|
|
find(Predicate, [H|T]) when is_function(H) ->
|
|
Value = ?FORCE(H),
|
|
case Predicate(Value) of
|
|
true ->
|
|
{ok, Value};
|
|
_ ->
|
|
find(Predicate, T)
|
|
end;
|
|
find(_Predicate, []) ->
|
|
undefined.
|