Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -export([ld/1]).
- ld([])->0;
- ld([2|T])->1+ld(T);
- ld([_|T])->0+ld(T).
- х
- ld(E)->ld(E,0).
- ld([],Len)->Len;
- ld([_|E],Len)->ld(E,Len+1).
- get_users()->
- [
- {user,1,"a",10},
- {user,2,"b",150},
- {user,3,"c",160},
- {user,4,"d",107}
- ].
- get_sum(E)->get_sum(E,0).
- get_sum([],N)->N;
- get_sum([E|I],N)->
- {user,X,_,_}=E,
- get_sum(I,N+X).
- filter(E)->filter(E,[]).
- filter([],Ac)->Ac;
- filter([E|I],Ac)->
- case E of
- {user,_,"bob",_}-> filter(I,[E|Ac]) ;
- _-> filter(I,Ac)
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement