20
爲什麼編譯此代碼:爲什麼Erlang變量未被使用?
triples([], _,_,_)->
[];
triples(Self, X, Y, none)->
[ Result || Result = { X, Y, _} <- Self ].
報告:
./simple_graph.erl:63: Warning: variable 'X' is unused
./simple_graph.erl:63: Warning: variable 'Y' is unused
./simple_graph.erl:64: Warning: variable 'X' is unused
./simple_graph.erl:64: Warning: variable 'X' shadowed in generate
./simple_graph.erl:64: Warning: variable 'Y' is unused
./simple_graph.erl:64: Warning: variable 'Y' shadowed in generate
,並返回錯誤的結果:全自助。
哇。這是一個難題! – Christian 2009-08-15 10:58:21
關於範圍如何在Erlang中工作的很好的解釋。精彩的List-Comprehension-Ninja – Aus 2017-05-03 11:28:08