我正在尝试交换 ML 列表中的元素。我的交换函数返回插入 EQUALOP 的错误。
fun swap(n:int, i:int, deck:card list) =
local
val card1_removed = nth(deck,i)
val card2_removed = nth(deck,n)
in
val deck = remove(deck,i)
val deck = remove(deck,n)
val deck = insert_at(deck,n,card1_removed)
val deck = insert_at(deck,i,card2_removed)
print_cards(deck);
end;
有什么建议么?