## A Second Year Course on Data Structures Based on Functional Programming (1995)

Venue: | Nijmegen (The Netherlands |

Citations: | 5 - 1 self |

### BibTeX

@TECHREPORT{Nunez95asecond,

author = {Manuel Nunez and Pedro Palao and Ricardo Pena},

title = {A Second Year Course on Data Structures Based on Functional Programming},

institution = {Nijmegen (The Netherlands},

year = {1995}

}

### OpenURL

### Abstract

. In this paper, we make a proposal for a second year course on advanced programming, based on the functional paradigm. It assumes the existence of a first course on programming, also based on functional languages. Its main subject is data structures. We claim that advanced data structures and algorithms can be better taught at the functional paradigm than at the imperative one, and that this can be done without losing efficiency. We also claim that, as a consequence of the higher level of abstraction of functional languages, more subjects can be covered in the given amount of time. In the paper, numerous examples of unusual data structures and algorithms are presented illustrating the contents and the philosophy of the proposed course. 1 Introduction The controversy about the use of a functional language as the first programming language is still alive. Several proposals have been made on a first programming course based on the functional paradigm or on a mixture of the functional a...

### Citations

1354 | Introduction to Functional Programming
- Bird, Wadler
- 1988
(Show Context)
Citation Context ...ctional programming and some imperative notions such as arrays, iteration, . . . . Text books: A combination of texts on functional programming and conventional texts on data structures. For instance =-=[1, 4, 7]-=-. Duration of the course: 30 weeks. sessions duration duration per week per session per week lecture hours 2 × 1h = 2h tutorials 2 × 1h = 2h laboratories 1 × 3h = 3h private tuition = 6h The laborator... |

773 |
Structure and Interpretation of Computer Programs
- Abelson, Sussman, et al.
- 1985
(Show Context)
Citation Context ...ctional programming and some imperative notions such as arrays, iteration, . . . . Text books: A combination of texts on functional programming and conventional texts on data structures. For instance =-=[1, 4, 7]-=-. Duration of the course: 30 weeks. sessions duration duration per week per session per week lecture hours 2 × 1h = 2h tutorials 2 × 1h = 2h laboratories 1 × 3h = 3h private tuition = 6h The laborator... |

299 | Why functional programming matters
- Hughes
- 1989
(Show Context)
Citation Context ...tablished and solved assuming applicative order of evaluation, i.e. eager languages. However, lazy languages offer better opportunities for teaching as they allow a more abstract style of programming =-=[10]-=-. Unfortunately, cost analysis of lazy functional programs is not developed enough (see [19] for a recent approach) to be taught at a second year course. So, we propose to analyze the cost assuming ea... |

122 |
Report on the functional programming language Haskell, Version 1.2
- Hudak, Jones, et al.
- 1992
(Show Context)
Citation Context ...egantly replace their imperative equivalent ones whose efficiency is based on the constant access time of arrays. Some implementations may even use arrays (purely functional languages such as Haskell =-=[9]-=- provide this structure as primitive), but in a read-only way. So, they do not rely on complex techniques or smart compilers to guarantee that arrays are not copied. More details are given in Sect. 5.... |

114 | Lazy functional state threads
- Launchbury, Jones
- 1994
(Show Context)
Citation Context ...ues have been proposed to help the compiler in this task. Recently, two solutions, allowing a great expressive power and with a low number of restrictions, have been given: monadic 16 data structures =-=[15]-=- and uniqueness types [3]. They allow to simultaneously have several data structures treated in a single-threaded way. In the presentation of the algorithms to the students, we recommend to use a styl... |

70 | Conventional and uniqueness typing in graph rewrite systems
- Barendsen, Smetsers
- 1993
(Show Context)
Citation Context ...help the compiler in this task. Recently, two solutions, allowing a great expressive power and with a low number of restrictions, have been given: monadic 16 data structures [15] and uniqueness types =-=[3]-=-. They allow to simultaneously have several data structures treated in a single-threaded way. In the presentation of the algorithms to the students, we recommend to use a style asumming that the compi... |

47 |
Self-Adjusting Heaps
- Sleator, Tarjan
- 1986
(Show Context)
Citation Context ...nsulting the minimum, because in imperative programming heaps are implemented by arrays. There exist other imperative data structures, more general and with very good complexities, such as skew heaps =-=[20]-=-, but they cannot be easily translated to the functional framework. Fortunately, there exist data structures adequate for its implementation in a functional language: binomial queues [12] and leftist ... |

39 | A Näıve Time Analysis and its Theory of Cost Equivalence
- Sands
- 1994
(Show Context)
Citation Context ..., lazy languages offer better opportunities for teaching as they allow a more abstract style of programming [10]. Unfortunately, cost analysis of lazy functional programs is not developed enough (see =-=[19]-=- for a recent approach) to be taught at a second year course. So, we propose to analyze the cost assuming eager evaluation, and to use the result as an upper bound for lazily evaluated programs. Of co... |

27 | Structuring depth-first search algorithms in Haskell
- King, Launchbury
- 1995
(Show Context)
Citation Context ...lementations using arrays does not present special problems. As well as for queues, the corresponding translations of imperative heaps and hash tables are simple. 6.2 Graphs Revisited The recent work =-=[13]-=- is a good example showing how modern functional languages and the use of mutable arrays (monadically implemented) can be applied to the implementation of algorithms on graphs. It contains very valuab... |

26 | Simple and efficient purely functional queues and deques
- Okasaki
- 1994
(Show Context)
Citation Context ...implementations, the amortized constant time implementation given in Sect. 4 is presented. More advanced queue implementations could be covered later in the course using, for example, the material in =-=[16]-=-. Lists are considered primitive types. Students have extensively worked with lists in their first course. In contrast with the imperative course, we lose some implementations: circular lists, two-way... |

16 | Mutable abstract datatypes or How to have your state and munge it too
- Hudak
- 1993
(Show Context)
Citation Context ...o appear in the imperative implementation of data types. For monadic data structures, there exist techniques which mechanically relate the monadic and non monadic implementations of a given type (see =-=[8]-=-). For uniqueness types, the conversion techniques are very easy because there is only a trivial change in the signature, and the compiler can infer the uniqueness types. 7 Conclusion We have presente... |

12 | Functional binomial queues
- King
- 1994
(Show Context)
Citation Context ...s skew heaps [20], but they cannot be easily translated to the functional framework. Fortunately, there exist data structures adequate for its implementation in a functional language: binomial queues =-=[12]-=- and leftist trees [7]. Here, we show the last one because it is simpler: data Ord a => Leftist a = Empty | Node Int (Leftist a) a (Leftist a) These trees have the same invariant property as heaps: th... |

9 |
Using Miranda as a first programming language
- Lambert, Lindsay, et al.
- 1993
(Show Context)
Citation Context ...ive. Several proposals have been made on a first programming course based on the functional paradigm or on a mixture of the functional and imperative ones. Some of them have been actually implemented =-=[11, 14]-=-. Many teachers feel that the functional paradigm is better suited than the imperative one to introduce students to the design of algorithms, and we do not want to repeat here the numerous arguments g... |

7 |
der Hoeven. Teaching functional programming to first-year students
- Joosten, Berg, et al.
(Show Context)
Citation Context ...ive. Several proposals have been made on a first programming course based on the functional paradigm or on a mixture of the functional and imperative ones. Some of them have been actually implemented =-=[11, 14]-=-. Many teachers feel that the functional paradigm is better suited than the imperative one to introduce students to the design of algorithms, and we do not want to repeat here the numerous arguments g... |

7 |
Balanced trees with removals: an exercise in rewriting and proof
- Reade
- 1992
(Show Context)
Citation Context ...-3 trees. Fortunately, the algorithms for insertion and deletion result so concise that they can be completely developed in a single lecture. A good reference for 2-3 trees in a functional setting is =-=[18]-=-. Just to show how compact the algorithms result, we are presenting here our version of AVL-trees: data Ord a => AVLTree a = Empty | Node Int (AVLTree a) a (AVLTree a) The Node constructor has as its ... |

6 |
On the existence of initial models for partial (higher-order) conditional specifications
- Astesiano, Cerioli
- 1989
(Show Context)
Citation Context ...ifies that, if (an instance of) s is well defined and (the corresponding instance of) s’ is congruent to s, then (the corresponding instances of) t and t’ are well defined and they are congruent (see =-=[2, 17]-=- for details). A consequence of the theory underlying this style of specification is that terms not explicitly mentioned in the conclusion of an equation are undefined by default. For instance, in the... |

5 |
Diseño de Programas: Formalismo y Abstracción
- Peña
- 1993
(Show Context)
Citation Context ...ifies that, if (an instance of) s is well defined and (the corresponding instance of) s’ is congruent to s, then (the corresponding instances of) t and t’ are well defined and they are congruent (see =-=[2, 17]-=- for details). A consequence of the theory underlying this style of specification is that terms not explicitly mentioned in the conclusion of an equation are undefined by default. For instance, in the... |

2 | Why Functional Programming Matters, pages 17--43. Research Topics in Functional Programming - Hughes - 1990 |

1 | Non homomorphic reductions of data structures
- Gal'an, N'unez, et al.
- 1994
(Show Context)
Citation Context ...sily and clearly presented: height of the tree, traversals, balance conditions, etc. Anyway, most of the times recursion can be avoided using the corresponding versions of fold and map for trees (see =-=[4, 5]-=-). Binary search trees, general trees, and their operations are the next topics. Their definitions follow: data Ord a => SearchTree a = Empty | Node (SearchTree a) a (SearchTree a) data Tree a = Node ... |

1 |
A logarithmic implementation of flexible arrays
- Hoogerwood
(Show Context)
Citation Context ... language are 6kept, and nothing is lost with respect to the efficient use of the computer. We present structures not very common, such as the functional versions of leftist trees [7] and Braun trees =-=[6]-=-, which can elegantly replace their imperative equivalent ones whose efficiency is based on the constant access time of arrays. Some implementations may even use arrays (purely functional languages su... |