看板 PLT 關於我們 聯絡資訊
type config = Inter of statement * state | Fianl of state 老師作業中應該是要讓 natural_semantics 的type為 config->config = <fun> 不過實際寫起來覺得似乎不太可行 因為根本不可能知道回傳的config是Inter還是Final 於是根本無法遞迴(題目沒有加rec,可是by definition ns 是遞迴沒錯) (除非在每個用到遞迴的match元素中都另外match所有的Inter, Final..) 這跟定義也不盡相同: In a natural semantics we are concerned with the relationship between the initial and the final state of an execution. (page 20) 雖然這定義並不強 但如果將natural semantics設定成 (statement,state)->state = <fun> 實際撰寫時就容易多了,不然我沒辦法解開實際撰寫時碰到的ambiguous 不過這只是我硬凹題目的結果 不知道有沒有強者有辦法在config->config的架構下寫出來? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.45.174.80