[Haskell-cafe] What is this function?

2008-10-16 Thread John Ky
Hi, I've written this function here: scramble [] = [] scramble [x] = [[z] | z - scramble x] scramble (x:xs) = [(y:z)|y - scramble x, z - scramble xs] and (I think) it roughly does what I want it to: *Main scramble ([]::[Int]) [] *Main scramble ([1]::[Int]) [[1],[2]]

Re: [Haskell-cafe] What is this function?

2008-10-16 Thread Luke Palmer
2008/10/16 John Ky [EMAIL PROTECTED]: Hi, I've written this function here: scramble [] = [] scramble [x] = [[z] | z - scramble x] scramble (x:xs) = [(y:z)|y - scramble x, z - scramble xs] and (I think) it roughly does what I want it to: *Main scramble ([]::[Int])

Re: [Haskell-cafe] What is this function?

2008-10-16 Thread Janis Voigtlaender
John Ky wrote: Hi, I've written this function here: scramble [] = [] scramble [x] = [[z] | z - scramble x] scramble (x:xs) = [(y:z)|y - scramble x, z - scramble xs] and (I think) it roughly does what I want it to: That is strange, as it does not even type-check ;-) See the y

Re: [Haskell-cafe] What is this function? (RESOLVED)

2008-10-16 Thread John Ky
Hi Luke, Thankyou so much. I need the sequence function. What I was after was this: class Scramblable a where scramble :: a - [a] instance Scramblable [MyType] where scramble values = sequence (map scramble values) instance Scramblable MyType where scramble myType = {- blah blah -}