diff options
Diffstat (limited to 'Assignment 1/CamilStaps-assignment1-shift.hs')
-rw-r--r-- | Assignment 1/CamilStaps-assignment1-shift.hs | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/Assignment 1/CamilStaps-assignment1-shift.hs b/Assignment 1/CamilStaps-assignment1-shift.hs deleted file mode 100644 index 35a34e7..0000000 --- a/Assignment 1/CamilStaps-assignment1-shift.hs +++ /dev/null @@ -1,14 +0,0 @@ -import System.Environment -import Data.String.Utils - -main = do - args <- getArgs - let input = replace " " "" (head args) - print $ map (`shiftN` (read $ args!!1)) input - --- shiftN c i: shift c i times forward (i.e. shiftN 'A' 1 == 'B') --- Only for uppercase letters -shiftN :: Char -> Int -> Char -shiftN c 0 = c -shiftN 'Z' i = shiftN 'A' (i-1) -shiftN c i = shiftN (toEnum ((fromEnum c) + 1)) (i-1)
\ No newline at end of file |