type Name = string;
datatype Expr = Const of int
| Var of Name
| Neg of Expr
| Plus of Expr * Expr
| Mult of Expr * Expr
| App of Fun * Expr
and Fun = Def of Name * Expr
(* substitute every x in expression z with expression y *)
fun substitute (Name x, Expr y, Expr z) = if x = z then y else z;
xとzの文字列値を比較したいのですが、同じ場合はyを返し、それ以外の場合はzを返しますが、このエラーが発生し続けますか?
e.sml:13.33-13.39 Error: non-constructor applied to argument in pattern: Expr
e.sml:13.25-13.31 Error: non-constructor applied to argument in pattern: Expr
e.sml:13.17-13.23 Error: non-constructor applied to argument in pattern: Name
e.sml:13.50 Error: unbound variable or constructor: z
e.sml:13.46 Error: unbound variable or constructor: x
e.sml:13.57 Error: unbound variable or constructor: y
e.sml:13.64 Error: unbound variable or constructor: z
uncaught exception Error
raised at: ../compiler/TopLevel/interact/evalloop.sml:66.19-66.27
../compiler/TopLevel/interact/evalloop.sml:44.55
../compiler/TopLevel/interact/evalloop.sml:296.17-296.20