How to check if head is list in F# -


Is there an item to check any object that has a list?

I did it like this:

  let x = unbox & lt; List & lt; Obj & gt; & Gt; (L) .... Try it with. _ - & gt; ...  

But if possible, I would like to check it with one or a match instead.

If you know the type of list elements, then you can use this type of code: < / P>

  let_list (x: obj) = with match x | : & Lt; Int & gt; - & gt; Printfn "int list" | : & Lt; String & gt; - & gt; Printfn "string list" | _ - & gt; Printfn "unknown object"  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -