From be4bafd1d32a293c9f67782da7325263d19ee5a5 Mon Sep 17 00:00:00 2001 From: Hammy Date: Mon, 5 Apr 2021 03:47:02 +0100 Subject: [PATCH] Add Washington DC Location --- Unit 1/Lesson 4/returningFunctions.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Unit 1/Lesson 4/returningFunctions.hs b/Unit 1/Lesson 4/returningFunctions.hs index a485dfb..782b148 100644 --- a/Unit 1/Lesson 4/returningFunctions.hs +++ b/Unit 1/Lesson 4/returningFunctions.hs @@ -2,18 +2,20 @@ sfOffice :: ([Char], [Char]) -> [Char] sfOffice name = if surname < "L" then nameText ++ " - PO Box 1234 - San Francisco, CA, 94111" else nameText ++ " - PO Box 1010 - San Francisco, CA, 94109" - where surname = snd name - nameText = fst name ++ " " ++ surname - + where surname = snd name + nameText = fst name ++ " " ++ surname nyOffice :: ([Char], [Char]) -> [Char] nyOffice name = nameText ++ ": PO Box 789 - New York, NY, 10013" - where nameText = fst name ++ " " ++ snd name - + where nameText = fst name ++ " " ++ snd name renoOffice :: (a, [Char]) -> [Char] renoOffice name = nameText ++ " - PO Box 456 - Reno, NV 89523" - where nameText = snd name + where nameText = snd name + +wdcOFfice :: ([Char], [Char]) -> [Char] +wdcOFfice name = nameText ++ " - PO BOX 831 - Washington, DC, 12130" + where nameText = fst name ++ " " ++ snd name ++ ", Esq." getLocation :: [Char] -> ([Char], [Char]) -> [Char] @@ -21,6 +23,7 @@ getLocation location = case location of "ny" -> nyOffice "sf" -> sfOffice "reno" -> renoOffice + "wdc" -> wdcOFfice _ -> (\name -> fst name ++ " " ++ snd name)