Compare strings in haskell -
I have two strings that are given as arguments for the hacecale function. S1 is smaller than s2 if s1 is smaller than s2 or if they have the same length and s1 is less granular than s2.
I will use something like the following:
small :: String - & gt; String - & gt; Small S S S 2 | Len1 / = len2 = (len1 & lt; len2) | Otherwise = (S1 and lieutenant; s2) where (len1, len2) = (length s1, length s2) Here is a sample run in hg:
Main> small "B" "AA" true main> small "A" "B" false main> small "this" "false"> small "This" true "
Comments
Post a Comment