[Haskell-cafe] What is this function?

Janis Voigtlaender voigt at tcs.inf.tu-dresden.de
Thu Oct 16 05:08:34 EDT 2008


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 <- scramble x" part.

-- 
Dr. Janis Voigtlaender
http://wwwtcs.inf.tu-dresden.de/~voigt/
mailto:voigt at tcs.inf.tu-dresden.de


More information about the Haskell-Cafe mailing list