Abstract

This paper is devoted to the synthesis of a functional version of the Knuth-MorrisPratt algorithm for pattern matching. This algorithm was first discussed by Knuth [6]; since then formal developments have been given by Dijkstra [4] and Dromey [5], among many others. The novel aspects of the present treatment are: (i) the result is expressed as a (very short) functional program; and (ii) the derivation makes use of the calculus of lists described by Bird [ 11. In order to make this paper as self-contained as possible, we shall indicate the concepts and notations of [l] used in our derivation as we go along. However, we do assume some familiarity with the basic ideas of functional programming. (For an introduction to functional programming, see Bird and Wadler [3].) The calculus of lists is based on the definition of lists as an algebraic structure (actually, a monoid) under the primitive operation of concatenation, denoted by the sign *. Thus

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.