Elixir: Recursion with accumulator
🚧 In development
Instructions
🚧 In development
If you've reached a deadlock it's time to ask your question in the «Discussions». How ask a question correctly:
- Be sure to attach the test output, without it it's almost impossible to figure out what went wrong, even if you show your code. It's complicated for developers to execute code in their heads, but having a mistake before their eyes most probably will be helpful.
Elixir: Recursion with accumulator
🚧 In development
Instructions
🚧 In development
If you've reached a deadlock it's time to ask your question in the «Discussions». How ask a question correctly:
- Be sure to attach the test output, without it it's almost impossible to figure out what went wrong, even if you show your code. It's complicated for developers to execute code in their heads, but having a mistake before their eyes most probably will be helpful.
Your exercise will be checked with these tests:
defmodule Test do
use ExUnit.Case
import Solution
setup do
users = [
{:user, 1, "Bob", 23},
{:user, 2, "Helen", 20},
{:user, 3, "Bill", 15},
{:user, 4, "Kate", 14}
]
[users: users]
end
test "filter_by_age test", %{users: users} do
assert filter_by_age(users, 30) == []
assert filter_by_age(users, 23) == []
assert filter_by_age(users, 22) == [{:user, 1, "Bob", 23}]
assert filter_by_age(users, 20) == [{:user, 1, "Bob", 23}]
assert filter_by_age(users, 19) == [{:user, 1, "Bob", 23}, {:user, 2, "Helen", 20}]
assert filter_by_age(users, 15) == [{:user, 1, "Bob", 23}, {:user, 2, "Helen", 20}]
assert filter_by_age(users, 14) == [
{:user, 1, "Bob", 23},
{:user, 2, "Helen", 20},
{:user, 3, "Bill", 15}
]
assert filter_by_age(users, 13) == [
{:user, 1, "Bob", 23},
{:user, 2, "Helen", 20},
{:user, 3, "Bill", 15},
{:user, 4, "Kate", 14}
]
assert filter_by_age(users, 10) == [
{:user, 1, "Bob", 23},
{:user, 2, "Helen", 20},
{:user, 3, "Bill", 15},
{:user, 4, "Kate", 14}
]
end
endTeacher's solution will be available in:
20:00
