fork download
  1. bubblesort xs
  2. | xs == xs' = xs'
  3. | otherwise = bubblesort xs'
  4. where xs' = bubblesortIterate xs
  5. where bubblesortIterate x:xs@lst
  6. | nil . xs = xs
  7. | x <= head xs = x:bubblesortIterate xs
  8. | otherwise = bubblesortSwap lst
  9. where bubblesortSwap x:y:xs = y:x:xs
  10.  
  11. bubblesort [4,2,40,0,13,10]
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
[1 of 1] Compiling Main             ( prog.hs, prog.o )

prog.hs:5:1: parse error on input `where'
stdout
Standard output is empty