Re: [Haskell] please improve this code - thanks

2013-08-24 Thread Jason Dagit
On Sat, Aug 24, 2013 at 5:45 AM, Me wrote: > Hi all. > I'm new to haskell. I have a puny piece of code: > > import Data.List.Split > > padL :: Int -> String -> String > padL n s > | length s < n = replicate (n - length s) '0' ++ s > You use `length s` but the computation is not shared betwee

Re: [Haskell] please improve this code - thanks

2013-08-24 Thread Jerzy Karczmarczuk
Le 24/08/2013 14:45, Me a écrit : I'm new to haskell. I have a puny piece of code: ... blah. Is it good haskell, bad haskell or average haskell? How can it be rewritten? Don't you think that 1. Telling us WHAT DO YOU WANT from your code 2. Signing your letter with a human name might help?

[Haskell] please improve this code - thanks

2013-08-24 Thread Me
Hi all. I'm new to haskell. I have a puny piece of code: import Data.List.Split padL :: Int -> String -> String padL n s | length s < n = replicate (n - length s) '0' ++ s | otherwise = s strInc :: String -> String -> String strInc sep str = let strarr = splitOn sep str