我正在尝试根据元素的第三个值选择列表中的最小元素。但是我在 min_proc 函数中使用高阶函数似乎存在问题。(我在 CPN 工具中使用 SML)
fun min_process(p1: DATA, p2: DATA) =
if (#3 p1 <= #3 p2)
then p1
else p2;
fun min_proc(l) =
if (l = [])
then empty
else
if (List.length(l) = 1)
then List.hd(l)
else min_process(List.hd(l), min_proc(List.tl(l)));
错误:
../compiler/TopLevel/interact/evalloop.sml:66.19-66.27