Programming with Functions
Evaluation in Numipulator is carried out through a set of linked functions (although a few of these are not true functions as they do not give the same result for the same inputs each time; these are concerned with random number generation and with producing a permutation of a list). Here, we look at why this is best described as programming with functions rather than functional programming, and compare the style of programming with that employed in spreadsheets such as Excel.
Numipulator and spreadsheets have much in common in terms of their programming with functions. Both provide the user with an extensive, but limited, set of functions that can be employed to determine the value of their core elements (cells in spreadsheets, numipulation boxes in Numipulator). The values from any one of these can be fed in as an input to another element through the use of reference names (e.g. A3).
Now, some authors have classified a spreadsheet as a functional programming language: Burnett et al (2001), when introducing the Forms/3 system, describe the spreadsheet paradigm as a first-order subset of the functional programming paradigm. In the sense that programs are constructed by applying and composing functions, then they are. However, functional programming can also be characterized as a paradigm in which functions are treated as first-class citizens, meaning that they can be passed as arguments, and returned from other functions, just like any other data type can be. It can also be characterized by its potential for lazy evaluation (Hughes, 1989) and its use of recursion, although recursion is also found in other paradigms such as logic programming. Now, recursion is not a feature of spreadsheets or Numipulator, and functions are not treated as first-class citizens in either and both employ eager evaluation only, so if spreadsheets and Numipulator are examples of functional programming, they are a very limited subset of it. Both are probably best described as programming with functions, rather than functional programming with all that implies.
M. Burnett, J. Atwood, R. Djang, H. Gottfried, J. Reichwein, S. Yang (2001) Forms/3: A First-Order Visual Language to Explore the Boundaries of the Spreadsheet Paradigm," Journal of Functional Programming 11(2), March 2001, pp. 155-206.
Hughes, J. (1989) Why Functional Programming Matters. The Computer Journal, Volume 32, Issue 2, pp. 98–107.
Copyright TopAccolades Limited, 2023