mirror of
https://github.com/correl/riichi.git
synced 2024-11-23 19:19:55 +00:00
18 lines
291 B
Erlang
18 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.
|