f# - How do you extract distinct elements from a list? -


i'm pretty new f# , i'm having hard time trying extract list of distinct values list:

let mylist = [ 1; 2; 2; 3; 4; 3 ] // desired list [ 1; 2; 3; 4 ] 

how do that? see seq has distinct method, not lists.

let mylist = [ 1; 2; 2; 3; 4; 3 ] let distinctlist = mylist |> seq.distinct |> list.ofseq 

result:

>  val mylist : int list = [1; 2; 2; 3; 4; 3] val distinctlist : int list = [1; 2; 3; 4] 

next f# version (4.0) have list.distinct function


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -