<jupyter_start><jupyter_text>Modules Loading a function from a file `baby.hs` which contains a function `doubleMe`<jupyter_code>:l baby
doubleMe 4
doubleMe 3.14
doubleMe pi<jupyter_output><empty_output><jupyter_text>Creating higher level functions<jupyter_code>doubleSum x y = doubleMe x + doubleMe y
doubleSum 10 20
doubleSum 1 2 + doubleSum 10 12<jupyter_output><empty_output><jupyter_text>* Functions in Haskell don't have to be in any particular order* Functions can be redefined<jupyter_code>doubleMe x = x * 3

doubleSum x y = doubleMe x + doubleMe y
doubleSum 10 20
:l baby.hs<jupyter_output><empty_output><jupyter_text>If-else statement<jupyter_code>doubleSmallNumber x = if x > 100
                         then x
                         else x * 2<jupyter_output><empty_output><jupyter_text>* else part is mandatory in Haskell* if-else statement is an expression as it always returns something<jupyter_code>doubleSmallNumber 101
doubleSmallNumber 99
doubleSmallNumber' x = (if x > 100 then x else x * 2) + 1
doubleSmallNumber' 101<jupyter_output><empty_output><jupyter_text>Apostrophe `'` is a valid character in a function name. Usually denoted to write a strict (non-lazy) version or a modified version.<jupyter_code>conanO'Brien = "It's a-me, Conan O'Brien!"<jupyter_output><empty_output><jupyter_text>* This is also a function with no input parameters* The convention is to use camelCase, although not strictly* Functions can't begin with uppercase<jupyter_code>snake_case = "Harrrrry pott-ahhhhh"<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07652399481193256, 'fraction_numerical': 0.023346303501945526, 'mean_word_length': 5.510548523206751, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '272634', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 547, 'n_tokens_neox': 493, 'n_words': 159, 'path': '00.1 - Of functions and modules.ipynb', 'repo_name': 'ashwinvis/experiments-with-haskell', 'size': '1542'}