<commit_before>#+TITLE: Notes for first iteration of Largest Palindrome Product

* 1st solution proposed
built without much regard to memory consumed
- create list of all 3 digit products (810,000 entries)
- filter palindromes
- reduce using max

* Contracts

** methods
: products(start end)
: palindrome-p(number)
: largest-palindrome-product(from to)

* Retrospective

** Ways to improve

** Lessons


<commit_msg>add retrospective to notes<commit_after>#+TITLE: Notes for first iteration of Largest Palindrome Product

* 1st solution proposed
built without much regard to memory consumed
- create list of all 3 digit products (810,000 entries)
- filter palindromes
- reduce using max

* Contracts

** methods
: products(start end)
: palindrome-p(number)
: largest-palindrome-product(from to)

* Retrospective
1st solution poorly implemented creation of list preventing tail call
optimisation. When implemented list as accumulator passed through
method calls the stack problems disappeared.

** Ways to improve
- could only accumulate products that are palindromes making the
  list much shorter

** Lessons
- used testing more appropriately allowing quick bottom up implementation
- always think about TCO when building lists
- thinking about list generation recursively rather than looping made me
  think about all the base cases and it seemed easier to avoid off by 1
  errors more commonly seen in loops



{'fraction_non_alphanumeric': 0.05091937765205092, 'fraction_numerical': 0.01272984441301273, 'mean_word_length': 4.775510204081633, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3018285', 'n_tokens_mistral': 388, 'n_tokens_neox': 358, 'n_words': 176}