Abstract
Sometimes it seems easier to construct a program for a problem than a suitable specification of the problem. Consider for instance the following exercise, expressed as it might occur in an introductory text on programing:
In the sequence
$$\left[ {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{5} ,7,5,\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{3} ,4,\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{1} ,7} \right]$$the underlined numbers are defined by the rule that each number, apart from the first, is the next element of the original sequence strictly smaller than the last underlined number. The first underlined number is the first element of the sequence. Call these numbers the drops of the sequence. Write a program to produce the drops of a given sequence.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
R. S. Bird . An introduction to the theory of lists. In M. Broy, editor, Logic of Programming and Calculi of Discrete Design, pages 3–42, Springer-Verlag, 1987. NATO ASI Series F, Vol. 36.
R. S. Bird. Lectures on constructive functional programming. In M. Broy, editor, Constructive Methods in Computing Science, Springer-Verlag, 1989. NATO ASI Series F, Vol. 55.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1990 Springer-Verlag New York, Inc.
About this chapter
Cite this chapter
Bird, R.S. (1990). Small Specification Exercises. In: Feijen, W.H.J., van Gasteren, A.J.M., Gries, D., Misra, J. (eds) Beauty Is Our Business. Texts and Monographs in Computer Science. Springer, New York, NY. https://doi.org/10.1007/978-1-4612-4476-9_5
Download citation
DOI: https://doi.org/10.1007/978-1-4612-4476-9_5
Publisher Name: Springer, New York, NY
Print ISBN: 978-1-4612-8792-6
Online ISBN: 978-1-4612-4476-9
eBook Packages: Springer Book Archive