type VAR = identifier
type code = instruction list
type environment = identifier list
type EXPR = environment -> code * environment
fun ADD_OP expr expr' env = DUMMY
fun SUB_
這種語言的語法很混亂。 fun bar a =
print (Int.toString a);
0
編譯。不知道爲什麼emacs縮進0。 fun bar a =
print (Int.toString a)
0
引發錯誤。 Error: operator is not a function [tycon mismatch]
operator
爲什麼編譯? fun foo (h::t) =
h = hd(t);
但這並不 fun foo (h::t) =
PolyML.print (h::t);
print "\n";
h = hd(t);
? Value or constructor (h) has not been declared Found near =(h, hd(t))
V
我沒那麼熟悉SML但我已經寫了下面的程序: datatype 'a bin_tree = Leaf of 'a
| Node of 'a bin_tree * 'a bin_tree
fun height Leaf (x) = 0
| height Node (l1,l2) = 1 + Int.max(l1,l2)
fun is_balanced Leaf (x) = true
|
我有一個正在正確工作的函數... 但是,不幸的是在顯示它之前構造了一個很大的字符串。 我想顯示每個字符串,而不是直接concatening人,但我不知道該怎麼辦呢? 下面是函數: fun getBlocked w =
case BlockingMgr.listBlockedSuccessors w
of nil => ""
| ws =>
concat (