proplists:delete/2
删除列表里所有跟键相关联的元素
用法:
delete(Key, List) -> List
内部实现:
-spec delete(Key, List) -> List when Key :: term(), List :: [term()]. delete(Key, [P | Ps]) -> if is_atom(P), P =:= Key -> delete(Key, Ps); tuple_size(P) >= 1, element(1, P) =:= Key -> delete(Key, Ps); true -> [P | delete(Key, Ps)] end; delete(_, []) -> [].
删除列表 List 里所有跟键 Key 相关联的元素。
proplists:delete(a, [{a, true}, {b, false}, c, {a, true}, {a, 1}, {a, [2]}]).