Elixir: Comprehensions
🚧 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: Comprehensions
🚧 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
test "fetch_gamers work" do
assert Solution.fetch_gamers([]) == []
employees = [
%{
name: "Eric",
status: :active,
hobbies: [%{name: "Text Adventures", type: :gaming}, %{name: "Chickens", type: :animals}]
},
%{
name: "Mitch",
status: :former,
hobbies: [%{name: "Woodworking", type: :making}, %{name: "Homebrewing", type: :making}]
},
%{
name: "Greg",
status: :active,
hobbies: [
%{name: "Dungeons & Dragons", type: :gaming},
%{name: "Woodworking", type: :making}
]
}
]
assert Solution.fetch_gamers(employees) == [
{"Eric", %{name: "Text Adventures", type: :gaming}},
{"Greg", %{name: "Dungeons & Dragons", type: :gaming}}
]
employees = [
%{
name: "Eric",
status: :former,
hobbies: [%{name: "Text Adventures", type: :gaming}, %{name: "Chickens", type: :animals}]
},
%{
name: "Alice",
status: :active,
hobbies: [
%{name: "World of Warcraft", type: :gaming}
]
}
]
assert Solution.fetch_gamers(employees) == [
{"Alice", %{name: "World of Warcraft", type: :gaming}}
]
employees = [
%{
name: "Mitch",
status: :former,
hobbies: [%{name: "Woodworking", type: :making}, %{name: "Homebrewing", type: :making}]
}
]
assert Solution.fetch_gamers(employees) == []
end
endTeacher's solution will be available in:
20:00
