I have a problem in CLEAN, how can I make lowercase all letter in a string? I can do it through an char array, but i need to do it with a string too. I have the code below so far:
module Something
import StdEnv, StdLib
arrayLower:: [Char] -> [Char]
arrayLower[x:xs] = (map toLower [x:xs])
stringLower:: String -> String
stringLower_ = ""
stringLowers = toString (arrayLower s)
Start:: String
Start = stringLower"SSSsss"
Your first case
means that
stringLowerapplied to anything is the empty string.I'm surprised that you didn't get a warning for the redundant second case.
A
Stringis an array (unboxed, so it's a{#Char}), and you say that you already know how to do this with arrays, but yourarrayLoweris defined for lists ofChar([Char]), not arrays.This, using an array comprehension, works for me: