Browse files

Haskell wip #4. Tests pass. Needs cleanup

  • Loading branch information...
1 parent f2c4851 commit dc4c7298af5c142ad1c6c55dc631c79e8544a61e @youngnh committed Nov 16, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 hs/LuhnyBin.hs
View
9 hs/LuhnyBin.hs
@@ -41,9 +41,16 @@ ccWindow input =
Just (s,e) -> Just (s+1,e+1)
Nothing -> Nothing
-redact line start end = prefix ++ (replicate (end - start) 'X') ++ suffix
+between xs start end = take (end - start) $ drop start xs
+
+redact line start end = prefix ++ redacted ++ suffix
where (prefix,_) = splitAt start line
(_,suffix) = splitAt end line
+ middle = take (end - start) $ drop start line
+ redact' c = if isDigit c
+ then 'X'
+ else c
+ redacted = map redact' middle
redactLine :: IO ()
redactLine = do

0 comments on commit dc4c729

Please sign in to comment.