{'fraction_non_alphanumeric': 0.015488867376573089, 'fraction_numerical': 0.0, 'mean_word_length': 5.191616766467066, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, '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}}
Non-uniform Recursion: The solution (minimal sorting for fold)

A central data structure in functional programming languages like ML or Haskell are algebraic data types. I argue in this paper that the natural program structure to deal with algebraic data types is not yet provided either in Haskell or in ML. One might think that that pattern matching together with general recursion is the natural program structure to deal with algebraic data types. But the use of general recursion runs into trouble when faced to deal with non-uniform recursive data through fundamental problems of type inference (the non-decidability of polymorphic recursion). What we provide for algebraic data types is a structural recursion mechanism that derives generalised fold functions from algebraic data specification. Especially non-uniform folds are an byproduct of these more general folds. The structural recursion mechanism is presented together with a typing method which relies on a method of minimal sorting for algebraic data specifications.