How can i convert between F# List and F# Tuple?

Posted by ksharp on Stack Overflow See other posts from Stack Overflow or by ksharp
Published on 2010-05-27T10:01:04Z Indexed on 2010/05/28 3:01 UTC
Read the original article Hit count: 216

Filed under:

Is there some way to convert between F# List and F# Tuple?

For example:

[1;2;3] -> (1,2,3)    
(1,2,3,4) -> [1;2;3;4]

I need two Functions to do that:

let listToTuple list = ...
let tupleToList tuple = ...

Thank you in advance.


I think reflection is necessary to this problem.

I know the performance is not good.

I have to pay the cost of breaking functional programming rule.

© Stack Overflow or respective owner

Related posts about F#