
module Main (main) where quicksort [] = [] quicksort (s:xs) = quicksort [x|x <- xs,x < s] ++ [s] ++ quicksort [x|x <- xs,x >= s] main = putStr "Ingrese la lista\n" [xs] <- getLine

What is your question?
On Mon, Nov 7, 2011 at 9:45 AM, yrazes
module Main (main) where quicksort [] = [] quicksort (s:xs) = quicksort [x|x <- xs,x < s] ++ [s] ++ quicksort [x|x <- xs,x >= s] main = putStr "Ingrese la lista\n" [xs] <- getLine _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- -- Regards, KC

Sorry, but I got this error while I compile it.
*
*
*[yulys@yulys haskell]$ ghc -o quick quick.hs*
*[1 of 1] Compiling Main ( quick.hs, quick.o )*
*
*
*quick.hs:7:11: parse error on input `<-'*
*[yulys@yulys haskell]$ *
On Mon, Nov 7, 2011 at 4:23 PM, KC
What is your question?
On Mon, Nov 7, 2011 at 9:45 AM, yrazes
wrote: module Main (main) where quicksort [] = [] quicksort (s:xs) = quicksort [x|x <- xs,x < s] ++ [s] ++ quicksort [x|x <- xs,x >= s] main = putStr "Ingrese la lista\n" [xs] <- getLine _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- -- Regards, KC

You can narrow down the problem by commenting out the part of the file
that's giving you problems, and trying out the other functions in ghci. In
your case, the main function is causing a parsing error. If you comment it
out, you can verify that quicksort works correctly. Then look at your main
function and see where it's broken. Try this out, and compare with what you
wrote:
module Main (main) where
quicksort [] = []
quicksort (s:xs) = quicksort [x | x <- xs, x < s] ++ [s] ++ quicksort [x |
x <- xs, x >= s]
main = do
putStr "Ingrese la lista\n"
line <- getLine
let xs = read line :: [Int]
print (quicksort xs)
-Peter
On Mon, Nov 7, 2011 at 3:41 PM, yrazes
Sorry, but I got this error while I compile it. * * *[yulys@yulys haskell]$ ghc -o quick quick.hs* *[1 of 1] Compiling Main ( quick.hs, quick.o )* * * *quick.hs:7:11: parse error on input `<-'* *[yulys@yulys haskell]$ *
On Mon, Nov 7, 2011 at 4:23 PM, KC
wrote: What is your question?
On Mon, Nov 7, 2011 at 9:45 AM, yrazes
wrote: module Main (main) where quicksort [] = [] quicksort (s:xs) = quicksort [x|x <- xs,x < s] ++ [s] ++ quicksort [x|x <- xs,x >= s] main = putStr "Ingrese la lista\n" [xs] <- getLine _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- -- Regards, KC
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (3)
-
KC
-
Peter Scott
-
yrazes