Skip to content

Instantly share code, notes, and snippets.

@devshorts
Last active December 21, 2015 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devshorts/6359736 to your computer and use it in GitHub Desktop.
Save devshorts/6359736 to your computer and use it in GitHub Desktop.
Crappy discriminated union filtering
let result = test parserStream video
let moov = List.find(function | MOOV(x) -> true | _ -> false) result
let sttsElements =
match moov with
| MOOV(l) ->
List.filter (function | TRAK(_) -> true | _ -> false) l
|> List.map (function | TRAK(l) -> l)
|> List.collect id
|> List.filter (function | MDIA(x) -> true | _ -> false)
|> List.map (function |MDIA(x) -> x)
|> List.collect id
|> List.filter (function | MINF(x) -> true | _ -> false)
|> List.map (function | MINF(x) -> x)
|> List.collect id
|> List.filter (function | STBL(x) -> true | _ -> false)
|> List.map (function | STBL(x) -> x)
|> List.collect id
|> List.filter(function | STTS(x) -> true | _ -> false)
|> List.map(function | STTS(x) -> x)
| _ -> failwith "error"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment