【发布时间】:2016-11-29 19:56:32
【问题描述】:
我需要编写自己的 tuple_to_list() 函数(是的,来自 the 书)并在我的 erl 文件中提出了这个:
%% Our very own tuple_to_list function! %%
% First, the accumulator function
my_tuple_to_list_acc(T, L) -> [element(1, T) | L];
my_tuple_to_list_acc({}, L) -> L;
% Finally, the public face of the function
my_tuple_to_list(T) -> my_tuple_to_list_acc(T, []).
但是,当我编译它时,我在 shell 中收到以下错误:
28> c(lib_misc).
lib_misc.erl:34: head mismatch
lib_misc.erl:2: function my_tuple_to_list/1 undefined
error
我不知道存在什么“头部不匹配”,为什么函数未定义(我已将其添加到模块导出语句中,尽管我怀疑这与导出语句有很大关系)?
【问题讨论】:
标签: erlang