3rd CCSC Northwest Conference • Fall 2001 |

**Short Haskell applications: text, numbers, treesort and DFAs**

**Simple text processing
**

- higher-order list functions and a few simple utilities can be combined to do simple text processing

3rd CCSC Northwest Conference • Fall 2001 |

**Short Haskell applications: text, numbers, treesort and DFAs**

Simple text processing

**ROT-13 transcoder
**

- similar techniques allow us to define a basic "ROT-13" text encryption utility in about 5 lines

3rd CCSC Northwest Conference • Fall 2001 |

**Short Haskell applications: text, numbers, treesort and DFAs**

Simple text processing

ROT-13 transcoder

**Command-line interaction
**

- Haskell's pre-defined interaction process is based on whole inputs, but a few intervening functions allow us to easily define a line-by-line user interaction program

3rd CCSC Northwest Conference • Fall 2001 |

**Short Haskell applications: text, numbers, treesort and DFAs**

Simple text processing

ROT-13 transcoder

Command-line interaction

**Palindrome checking
**

- we can check whether a string is a palindrome by normalizing it and comparing it to its own reversal: the palindrome checker

3rd CCSC Northwest Conference • Fall 2001 |

**Short Haskell applications: text, numbers, treesort and DFAs**

Simple text processing

ROT-13 transcoder

Command-line interaction

Palindrome checking

**Numeral conversion in different bases
**

- by spotting certain symmetries in base-radix notation, we can easily write "generator functions" for arbitrary number bases which convert between strings and integers

3rd CCSC Northwest Conference • Fall 2001 |

**Short Haskell applications: text, numbers, treesort and DFAs**

Simple text processing

ROT-13 transcoder

Command-line interaction

Palindrome checking

Numeral conversion in different bases

**Binary trees and treesort
**

- a data type for binary search trees, plus an appropriate fold function over those trees, makes the definition of tree sort clear and compelling

3rd CCSC Northwest Conference • Fall 2001 |

**Short Haskell applications: text, numbers, treesort and DFAs**

Simple text processing

ROT-13 transcoder

Command-line interaction

Palindrome checking

Numeral conversion in different bases

Binary trees and treesort

**DFA simulation
**

- we can transcribe a definition of deterministic finite automata almost verbatim from a theory text, and then experiment with automata and strings