aboutsummaryrefslogtreecommitdiff
path: root/ch01
diff options
context:
space:
mode:
authorJan Sucan <jan@jansucan.com>2023-03-07 17:55:18 +0100
committerJan Sucan <jan@jansucan.com>2023-03-07 17:55:18 +0100
commit12a4dee6abb12b27f6921662fd3000421c47a127 (patch)
treefcfd6604dd9e2e3df585c1f11cdbbea612e74fe4 /ch01
parent31101069ca89118b7e6a802460c80d80e0d17f20 (diff)
1_a_3: Add solution
Diffstat (limited to 'ch01')
-rw-r--r--ch01/1_a_3.hs5
1 files changed, 5 insertions, 0 deletions
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"