We present a programming language model of the ideas behind Functional Adaptive Programming (AP-F) and our Java implementation, DemeterF. Computation in AP-F is encapsulated in sets of functions that implement a fold over a data structure with the help of a generic traversal. In this paper we define the syntax, semantics, and typing rules of a simple AP-F model, together with a proof of soundness that guarantees that traversal expressions result in a value of the expected type. Applying a function set to a different structure can then be statically checked to eliminate some runtime tests and sources of program errors. Categories and Subject Descriptors D.3.1 [Programming Languages]: Formal Definitions and Theory General Terms Languages,Theory Keywords Adaptive Programming, Functional Aspects, Traversals, Type Soundness
Bryan Chadwick, Karl J. Lieberherr