符号是什么? 在SML中是什么意思?

fun polysort(_,[]) = []
| polysort(_,[x]) = [x]!
| polysort(less,xs) =
 let
  val (ys, zs) = split xs
   in
   merge(less,polysort(less,ys), polysort(less, zs))
 end;

那会逆转它还是什么?我认为这与ref有关,但我也不明白。

最佳答案

通常,!是一个函数'a ref -> 'a,即extracts the value from a reference cell。即:

val x  = ref 1;  (* create reference cell *)
val () = x := 2; (* update value in x *)
val y = ! x;      (* extract value from x *)

但是,在这种情况下,它看起来像是一个错字。

10-04 16:30