Tuesday, 7 June 2016

Haskell: Convert list to set

Data.Set module provide fromList function which converts a list to set.

Prelude> :m Data.Set
Prelude Data.Set> 
Prelude Data.Set> let list1 = [2, 3, 5, 2, 3, 10, 19, 5]
Prelude Data.Set> 
Prelude Data.Set> let set1 = fromList list1
Prelude Data.Set> set1
fromList [2,3,5,10,19]



Previous                                                 Next                                                 Home

No comments:

Post a Comment