Prolog for imperative programmers

  • Authors:
  • Amruth N. Kumar

  • Affiliations:
  • Ramapo College of New Jersey, 505 Ramapo Valley Road, Mahwah, NJ

  • Venue:
  • Journal of Computing Sciences in Colleges
  • Year:
  • 2002

Quantified Score

Hi-index 0.00

Visualization

Abstract

Once students master the imperative programming paradigm, they find it hard to learn to work with a declarative language such as Prolog. In order to help our students make the transition from imperative to pure declarative programming, we have identified many common misconceptions and pitfalls to which imperative programmers are susceptible. We have attempted to recast the semantics of commonly misunderstood data and control constructs in Prolog in terms of the more familiar imperative constructs. Furthermore, in order to promote declarative rather than imperative programming in Prolog, we have devised a set of programming templates, organized by input-output characteristics of the problems to which they apply. We have found that these templates are helpful in teaching logic programming in our Comparative Programming Languages course.In this paper, we will present the common misconceptions of imperative programmers as they begin programming in Prolog, and our attempts to dispel them. We will also present and analyze the templates we have developed to help our students make the transition from imperative to declarative programming. Finally, we will list some of the problems that our students have successfully solved over the years, as evidence of the effectiveness of the tools and techniques we present.