相关疑难解决方法(0)

如何推翻受歧视的工会

我正在尝试对受歧视的联合实施折叠。DU称为Expr,表示程序表达式,并且通常是递归的。我正在尝试编写一个折叠,以递归方式累积 Exprs 上的操作结果。下面是我尝试写的折叠。

let rec foldProceduralExpr (folder : 's -> Expr list -> 's) (state : 's) (expr : Expr) : 's =
    let children =
        match expr with
        | Series s -> s.SerExprs
        | Lambda l -> [l.LamBody; l.LamPre; l.LamPost]
        | Attempt a -> a.AttemptBody :: List.map (fun ab -> ab.ABBody) a.AttemptBranches
        | Let l -> l.LetBody :: List.concat (List.map (fun lb -> match lb with LetVariable (_, expr) -> [expr] | LetFunction (_, _, body, _, pre, post, …
Run Code Online (Sandbox Code Playgroud)

f# abstract-syntax-tree fold discriminated-union

3
推荐指数
1
解决办法
581
查看次数