
29 Apr
2010
29 Apr
'10
2:01 p.m.
Hello all Correcting myself - in this case foldl is adequate - but it isn't pleasant as the list is produced in the wrong order: replaceCharAfterA_foldl' :: String -> String replaceCharAfterA_foldl' xs = reverse $ snd $ foldl' f ('Z',[]) xs where f ('A',cca) b = (b,'*':cca) f (_,cca) b = (b,b:cca) demo2 = replaceCharAfterA_foldl' "abcABC"
demo2 "abcA*C"
Best wishes Stephen