You may also find this function helpful. I'll let you work out why/how: uncurry :: (a -> b -> c) -> (a, b) -> c uncurry f p = f (fst p) (snd p)
On 9/13/07, Krzysztof Kościuszkiewicz <[EMAIL PROTECTED]> wrote: > On Fri, Sep 14, 2007 at 03:45:02AM +0100, PR Stanley wrote: > > > 5. Using merge, define a recursive function > > msort :: (Ord a) => [a] -> [a] > > that implements merge sort, in which the empty > > list and singleton lists are already sorted, and > > any other list is sorted by merging together the > > two lists that result from sorting the two halves of the list separately. : > > Hint: first define a function > > ¬halve :: [a] -> [([a], [a])] > > ¬that splits a list into two halves whose length differs by at most one. > > Split the input list using halve, sort both halves (as merge requires lists to > be sorted) and merge them into output list... > > Regards, > -- > Krzysztof Kościuszkiewicz > Skype: dr.vee, Gadu: 111851, Jabber: [EMAIL PROTECTED] > Mobile IRL: +353851383329, Mobile PL: +48783303040 > "Simplicity is the ultimate sophistication" -- Leonardo da Vinci > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe >
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe