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 . 即:
!
'a ref -> 'a
val x = ref 1; (* create reference cell *) val () = x := 2; (* update value in x *) val y = ! x; (* extract value from x *)
但是,在这种情况下,它看起来只是一个错字 .
1 回答
通常,
!
是函数'a ref -> 'a
,其中extracts the value from a reference cell . 即:但是,在这种情况下,它看起来只是一个错字 .