Example Programs
To view the example programs:
Sorting.sfe contains functional implementations of three classic sorting algorithms. Or it would if it were present, I seem to have lost that file.
ParserCombinators.sfe contains a set of parser combinators: higher-order functions for building parsers. These functions look quite elegant, with the symmetries between, say, the sequencer and alternater combinators being clearly visible. The visual version of this program differs from the textual version: in the visual version it is clearer to omit the intermediate named expressions, which exist only to avoid very long lines of text.
Datum.sfe is a data type and parser for LISP-like expressions. The parser is constructed from the parser combinators. This program makes heavy use of partially-applied functions.
Dict.sfe is a balanced binary tree (red-black tree) implementation of a finite map type. A by-product of using tree layout of functional programs is a particular clarity in the expression of algorithms that operate of tree-structured data. An example of this is in the tree-balancing functions in the red-black tree implementation. The algorithm most clearly described with tree diagrams. The translation into procedural code usually involves complicated nested conditionals. Functional implementations that make use of pattern-matching are much clearer, and the VFPE implementation is slightly clearer again (actually looking like the original diagrams).
Here are Haskell files upon which the VFPE code is based: