From 12a4dee6abb12b27f6921662fd3000421c47a127 Mon Sep 17 00:00:00 2001 From: Jan Sucan Date: Tue, 7 Mar 2023 17:55:18 +0100 Subject: 1_a_3: Add solution --- ch01/1_a_3.hs | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 ch01/1_a_3.hs (limited to 'ch01/1_a_3.hs') diff --git a/ch01/1_a_3.hs b/ch01/1_a_3.hs new file mode 100644 index 0000000..9a3d64d --- /dev/null +++ b/ch01/1_a_3.hs @@ -0,0 +1,5 @@ +-- The words function counts the number of words in a string. Modify the WC.hs +-- example to count the number of words in a file. + +main = interact wordCount + where wordCount input = show (length (words input)) ++ "\n" -- cgit v1.2.3