haskell - ERROR - Syntax error in input (unexpected symbol "large") -


i wrote code , if 2 strings each anagram of :

anagram :: string->string->bool             anagram w1 w2 = anagram1 x1 x2      y1 = break w1     y2 = break w2     x1 = quicksort y1     x2 = quicksort y2   anagram1 :: [string]->[string]->bool anagram1 (h1:t1)(h2:t2)     | h1!=h2 = false     | h1==h2 = anagram1 t1 t2     | otherwise = true   

i found code quicksort there http://c2.com/cgi/wiki?quicksortinhaskell

quicksort :: [string]->[string] quicksort [] = [] quicksort (h:t) = quicksort small ++ (h : quicksort(large))          small = [y | y <- t, y <= h]       large = [y | y <- t, y > h]   break :: string->[string] break s = map (\c -> [c]) s 

when run , take error syntax error in input (unexpected symbol "large") .

why wrong ?

if load ghci runs perfectly.

maybe indentation incorrect in clause.

in anagram keyword must indented , in haskell "not equal" /= , not !=

please use spaces everywhere.

it has yourmodule.break in anagram not conflict prelude.break.

just read error messages, computer trying speak you, listen ;)

test lots of code in ghci , you'll more comfortable haskell


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -