<commit_before># A Modular Architecture for Elm programs

This tutorial outlines the general architecture you will see in all Elm
programs. It is a simple pattern that is great for modularity, code reuse,
and testing. I find it somewhat shocking in its simplicity. We will start
with the basic pattern in a small example and slowly build on those core
principles.

To follow along with this tutorial, clone this repo and navigate to the root
directory.

## The Basic Pattern

The logic of every Elm program will break up into three cleanly separated
parts: model, update, and view. You can pretty reliably start with the
following skeleton and then iteratively fill in details for your particular
case.

```elm
-- MODEL

type alias Model = { ... }


-- UPDATE

type Action = Reset | ...

update : Action -> Model -> Model
update action model =
  case action of
    Reset -> ...
    ...


-- VIEW

view : Model -> Html<commit_msg>Encourage people to look at the code<commit_after># A Modular Architecture for Elm programs

This tutorial outlines the general architecture you will see in all Elm
programs. It is a simple pattern that is great for modularity, code reuse,
and testing. I find it somewhat shocking in its simplicity. We will start
with the basic pattern in a small example and slowly build on those core
principles.

To follow along with this tutorial, clone this repo and navigate to the root
directory. It can be helpful to look at the examples without all the words, so
do not be afraid to open the code in your editor and poke around!

## The Basic Pattern

The logic of every Elm program will break up into three cleanly separated
parts: model, update, and view. You can pretty reliably start with the
following skeleton and then iteratively fill in details for your particular
case.

```elm
-- MODEL

type alias Model = { ... }


-- UPDATE

type Action = Reset | ...

update : Action -> Model -> Model
update action model =
  case action of
    Reset -> ...
    ...


-- VIEW

view : Model -> Html
{'fraction_non_alphanumeric': 0.05657568238213399, 'fraction_numerical': 0.0, 'mean_word_length': 3.4307692307692306, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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}}
{'dir': 'git-commits-cleaned', 'id': '4450966', 'n_tokens_mistral': 533, 'n_tokens_neox': 501, 'n_words': 311}