IK
Size: a a a
IK
IK
A
jc
jc
VS
LL
NB
AR
find_first = fn clause ->
fn _, list, next ->
index = Enum.find_index(list, clause)
get_and_update_in(list, [Access.at(index)], next)
end
end
data = %{items: [%{id: 2, count: 2}, %{id: 1, count: 3}, %{id: 2, count: 4}]}
update_in(data, [:items, find_first.(&(2 == &1[:id])), :count], &(&1+1))
AR
AR
AR
AR
PG
case {2, 5} do
{x, y} when x in [1, 2] -> y + 1
{_, y} -> y
end
AR
PG
AR
AR
AR