[Haskell-cafe] String to Hash ?
benjamin.franksen at bessy.de
Thu Dec 8 08:29:23 EST 2005
On Thursday 08 December 2005 15:03, raptor wrote:
> I have made a simple Split function, here is how it works :
> str = "k1=v1|k2=v2|k3=v3"
> > map (sSplit '=') (sSplit '|' str)
> Now what I want to do is to return listOfPairs (instead listOflists)
> so that I can give this as parameter to Data.Map.fromList and build
> hash-like structure. What would be the easiest way ?
Write a function:
list_to_pair :: [a] -> (a,a)
and then map it over the list of lists:
map list_to_pair your_resulting_list_of_lists
More information about the Haskell-Cafe