hi dear all, anyone know how to make this work?
dropUselessBy = fn( g, ga ) ->
ga = ga -- [ g ]
ga ++ [ Map.drop( g, [ :stid, :oa, :og, :runtime ] ) ]
end
ga = Enum.reduce( ga, [], dropUseLessBy/2 ) #this is wrong
thanks
hi dear all, anyone know how to make this work?
dropUselessBy = fn( g, ga ) ->
ga = ga -- [ g ]
ga ++ [ Map.drop( g, [ :stid, :oa, :og, :runtime ] ) ]
end
ga = Enum.reduce( ga, [], dropUseLessBy/2 ) #this is wrong
thanks
You properly meant Enum.reduce(ga, [], &dropUseLessBy/2)
or Enum.reduce(ga, [], fn g, acc -> dropUseLessBy.(g, acc))
He meant Enum.reduce( ga, [], dropUseLessBy )
.
i tryed Enum.reduce( ga, [], dropUseLessBy )
but always get undefined function dropUseLessBy/0
Yes, thats because dropUseLessBy
is not the same as dropUselessBy
, its a simple typo.
If everything is spelled the same it works:
iex(1)> f = fn x, y -> x + y end
#Function<12.127694169/2 in :erl_eval.expr/5>
iex(2)> Enum.reduce(1..10, 0, f)
55
Geeee… that’s typo… it’s my fault
thank you guys