
What about... mySort xs = let myCompare x y | lx < ly = LT | lx == ly = EQ | lx > ly = GT where lx = length x ly = length y in sortBy myCompare xs M; 7stud wrote:
I get indenting errors with the following attempts to use let:
----- import Data.List (sortBy)
mySort xs = sortBy myCompare xs let lx = length x ly = length y in where myCompare x y | lx < ly = LT | lx == ly = EQ | lx > ly = GT
------------------
import Data.List (sortBy)
mySort xs = sortBy myCompare xs where myCompare x y let lx = length x ly = length y in
| lx < ly = LT | lx == ly = EQ | lx > ly = GT
-------------
import Data.List (sortBy)
mySort xs = sortBy myCompare xs where myCompare x y let lx = length x ly = length y in | lx < ly = LT | lx == ly = EQ | lx > ly = GT
-------------
This is what I ended up with:
------- import Data.List (sortBy)
mySort xs = sortBy myCompare xs where myCompare x y | lx < ly = LT | lx == ly = EQ | lx > ly = GT where lx = length x ly = length y -------
But I would like to know how to use let.
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners