Skip to content

Instantly share code, notes, and snippets.

@mikeobrien
Created December 17, 2010 01:06
Show Gist options
  • Save mikeobrien/744315 to your computer and use it in GitHub Desktop.
Save mikeobrien/744315 to your computer and use it in GitHub Desktop.
let GetUnionExpressions<'a> expression =
let getVisitorExpressions expression =
let unionVisitor = new UnionVisitor<'a>()
unionVisitor.Visit(expression : Expression) |> ignore
unionVisitor.Expressions
let rec getUnionExpressions (expressions : seq<UnionVisitor<'a>.UnionExpression>) =
if expressions |> Seq.isEmpty then Seq.empty
else expressions
|> Seq.collect (fun x -> x.Expression |> getVisitorExpressions |> getUnionExpressions)
|> Seq.append expressions
expression |> getVisitorExpressions |> getUnionExpressions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment