keyfind专题

erlang lists:keyfind的一个小坑

Key = 2/2,FindReuslt = lists:keyfind(Key, 1, [{1, 1}],case FindReuslt of{Key, Value} ->find;false ->not_findend. 这段代码会报没有匹配的错误 原因是 Key = 2/2 其实 Key被赋值为1.0 (摔,这个基础概念都能忘记) lists:keyfind 文档