diff options
| author | Jan Sucan <jan@jansucan.com> | 2023-03-07 18:00:16 +0100 |
|---|---|---|
| committer | Jan Sucan <jan@jansucan.com> | 2023-03-07 18:00:16 +0100 |
| commit | 2eeccee06144314ed4a0ed579fb893aa2f322982 (patch) | |
| tree | c111daa5a52a5aa219c809f6d63b7f3d48c1cd51 | |
| parent | 12a4dee6abb12b27f6921662fd3000421c47a127 (diff) | |
1_a_4: Add solution
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | ch01/1_a_4.hs | 5 |
2 files changed, 6 insertions, 1 deletions
@@ -46,7 +46,7 @@ more visible in the list the first exercise of a group is in bold italics. | **_1_a_1_** | yes | 16 | 1. Getting started | | 1_a_2 | yes | | | | 1_a_3 | yes | | | -| 1_a_4 | | | | +| 1_a_4 | yes | | | | **_2_a_1_** | | 25 | 2. Types and functions | | **_2_b_1_** | | 39 | | | 2_b_2 | | | | diff --git a/ch01/1_a_4.hs b/ch01/1_a_4.hs new file mode 100644 index 0000000..3d5afb4 --- /dev/null +++ b/ch01/1_a_4.hs @@ -0,0 +1,5 @@ +-- Modify the WC.hs example again, to print the number of characters in a file. + +-- Type of 'input' is String. Its length is the number of characters. +main = interact wordCount + where wordCount input = show (length input) ++ "\n" |
