---
# System prepended metadata

title: Untitled

---

``` elixir




#
# As part of our statistics efforts, Bynk needs to keep track ten
# smallest loan applications. Build an Elixir process that receives
# messages of the form {:loan 5000}, {:loan 20000} and keeps track of
# the 10 smallest loans. When the message :dump is received it should
# print out the ten smallest loans. Bynk processes a lot of loans so
# the algorithm needs to be somewhat efficient.

# {:loan, 5000}

handle_call({amont, Amount}, From, State) ->
  Value ?  store_in_db(Amount)
 {ok, {ranted, Amount, Value}, State}
 
 
 # Keep the ten smallest amounts 
keep_ten_smallest(NewAmount, ListOfCurrentTenSmallest) ->

L = reverse(lists:soer([Amount | OldList]))hd(L)

tail(L)
Enum.filter([2, 4, 2, 5 6], fn (a) ->a==2 end 



lists:filter(fun(a)-> a==2 end, [2, 3, 2]).



is_two([], Acc) -> Acc;
is_twoH | , AccT ->case H == 2 of
  true -> is_two(T,two(2, 3, 4, Acc) | Ac []);
  false -> is_
end

is_two([2, 3, 4, 2], [])



