From b210cb5b323a22849361cb2e2fa7dd3f71e8b881 Mon Sep 17 00:00:00 2001 From: Yuri Tatishchev Date: Mon, 9 Feb 2026 12:14:20 -0800 Subject: [PATCH] lab04: init --- lab04/mapFilter.hs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lab04/mapFilter.hs diff --git a/lab04/mapFilter.hs b/lab04/mapFilter.hs new file mode 100644 index 0000000..f381325 --- /dev/null +++ b/lab04/mapFilter.hs @@ -0,0 +1,25 @@ +-- USING MAP, convert a list of Strings to a list of Integers. +stringsToNums :: [String] -> [Integer] + + +-- USING MAP, take a list of integers and return a list with +-- the equivalent absolute values. + + +-- USING ZIPWITH, concatenate a list of first names with +-- a list of last names to produce a list of full names. + + +-- USING MAP AND FILTER, square all positive numbers in a list; +-- strip out 0 and negative numbers. + + +main :: IO () +main = do + print $ stringsToNums [] + print $ stringsToNums ["1", "2", "3", "4", "5"] + print $ mapAbsVal [-4, 3, 2, -99, 54] + print $ mapAbsVal $ stringsToNums ["-4", "7", "-22"] + print $ fullNames ["John", "Wes Happen", "Holly"] ["Smith", "Ng", "Wood"] + print $ squarePostives [2, -3, 45, 5, 0, 7, -6] + \ No newline at end of file