
March 16th, 2010, 04:11 PM
|
|
Registered User
|
|
Join Date: Feb 2010
Posts: 5
Time spent in forums: 1 h 5 m 40 sec
Reputation Power: 0
|
|
|
Haskell - Deal a pack of cards
Hi
Basically I am trying to write a function which takes a list of cards and deals it out to a given number of people. For example, dealing cards [a,b,c,d,e,f,g] to 3 people would return [[a,d,g],[b,e],[c,f]]. The types are Int -> [a] -> [[a]].
I can't figure out a way to do this in Haskell. I would have thought to maybe use two loops in Java but is this even possible in Haskell? Another thought I had would be to use modulus values but I can't figure this out either.
Any ideas would be much appreciated!!
|