Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Haskell wip #4. Tests pass. Needs cleanup

  • Loading branch information...
commit dc4c7298af5c142ad1c6c55dc631c79e8544a61e 1 parent f2c4851
Nate Young authored

Showing 1 changed file with 8 additions and 1 deletion. Show diff stats Hide diff stats

  1. +8 1 hs/LuhnyBin.hs
9 hs/LuhnyBin.hs
@@ -41,9 +41,16 @@ ccWindow input =
41 41 Just (s,e) -> Just (s+1,e+1)
42 42 Nothing -> Nothing
43 43
44   -redact line start end = prefix ++ (replicate (end - start) 'X') ++ suffix
  44 +between xs start end = take (end - start) $ drop start xs
  45 +
  46 +redact line start end = prefix ++ redacted ++ suffix
45 47 where (prefix,_) = splitAt start line
46 48 (_,suffix) = splitAt end line
  49 + middle = take (end - start) $ drop start line
  50 + redact' c = if isDigit c
  51 + then 'X'
  52 + else c
  53 + redacted = map redact' middle
47 54
48 55 redactLine :: IO ()
49 56 redactLine = do

0 comments on commit dc4c729

Please sign in to comment.
Something went wrong with that request. Please try again.