Error when try to get value in Call Expr -> (Expr option * MethodInfo * Expr list)
-
Thursday, April 26, 2012 7:49 AM
Error when try to get value in Call Expr -> (Expr option * MethodInfo * Expr list)
| Call (A,B,C) -> try_get_return_sig(C.Tail()) // Error at C.Tail | Value(A) -> A // Error when get value let rec try_get_return_sig(ex) = match ex with | Lambda (_,ex) -> try_get_return_sig ex | Let (a,b,cont) -> Assign(NodeValue(a.ToString()),NodeValue(b.ToString()),try_get_return_sig cont) | IfThenElse (a,t,e) -> HoareLogic(try_get_return_sig t,try_get_return_sig a,try_get_return_sig e) | Sequential (f,s) -> SeqStatementIntro(try_get_return_sig f, try_get_return_sig s) | Call (A,B,C) -> try_get_return_sig(C.Tail()) // Error at C.Tail | Value(A) -> A // Error when get value | Var var as ex -> NodeValue(var.ToString()) | b -> if b.ToString().Contains("op_GreaterThan") then Console.WriteLine(b.CustomAttributes.ToString()) let t = b.GetType() if FSharpType.IsUnion(t) then let union, fields = FSharpValue.GetUnionFields(b, t) for i = 1 to fields.GetLength(0) do Console.WriteLine(fields.[i].ToString()) if b.ToString().Contains("op_Equality") then Console.WriteLine(b.CustomAttributes.ToString()) let t = b.GetType() if FSharpType.IsUnion(t) then let union, fields = FSharpValue.GetUnionFields(b, t) for i = 1 to fields.GetLength(0) do Console.WriteLine(fields.[i].ToString()) NodeValue(b.ToString()) else NodeValue(b.ToString()) Call Expr -> (Expr option * MethodInfo * Expr list)
All Replies
-
Thursday, April 26, 2012 8:35 AM
Tail is not a function, so there must not be any braces after it.
Also, you should post compiler output message so that people can easily diagnose the problem.
-
Thursday, April 26, 2012 9:56 AM
'Expr list' is not compatible with 'Expr'
at | Call (A,B,C) -> try_get_return_sig(C.Tail)
The will of planet
-
Thursday, April 26, 2012 10:00 AMI don't know what do you expect to get, but compiler is perfectly correct. C.Tail is a list of arguments, and try_get_return_sig obviously expects single expression, not a list of expressions.
-
Thursday, April 26, 2012 10:17 AM
just want to programming into logic
final result will be something like
type expr = | Conj of expr * expr | Disj of expr * expr | GreaterThan expr * expr | NodeValue of string Disj(Conj(GreaterThan(x,1),NodeValue(2)),Conj(Neg(GreaterThan(x,1)),NodeValue(3))
The will of planet
-
Monday, April 30, 2012 9:42 AM
| Call (A,B,C) -> match B.ReturnParameter.Member.Name with | "op_Equality" -> Equal(NodeValue("x"), try_get_return_sig(List.head(List.rev(C)))) | _ -> try_get_return_sig(List.head(List.rev(C))) | Value(A) -> NodeValue(fst(A).ToString())我要呢個女人賠醫藥費
- Marked As Answer by 沈世鈞 Monday, April 30, 2012 9:42 AM

