Create a gist now

Instantly share code, notes, and snippets.

@lnds /tyf.erl
Created Jan 12, 2016

What would you like to do?
toques y famas en erlang
contar_toques_y_famas(Num,Sec) -> tyf(Num,Sec,Sec).
tyf([],_,_) -> {0,0};
tyf([HNS|TNS],[HXS|TXS],YS) ->
{T,F} = tyf(TNS,TXS,YS),
if HNS =:= HXS -> {T,F+1};
HNS =/= HXS -> {T+toque(HNS,YS),F}
end.
toque(X,XS) -> IN = lists:member(X,XS), if IN =:= true -> 1; IN =:= false -> 0 end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment