Results

**11 - 13**of**13**### Shallow Embedding of Prolog Programs

, 1999

"... C.A.R. Hoare's Unified Theory of Programming gives a single framework for describing the algebraic semantics of different programming paradigms. The work presented in this thesis is aimed towards incorporating the lacking parts of logic programming paradigm into this Unified Theory. As a first ..."

Abstract
- Add to MetaCart

C.A.R. Hoare's Unified Theory of Programming gives a single framework for describing the algebraic semantics of different programming paradigms. The work presented in this thesis is aimed towards incorporating the lacking parts of logic programming paradigm into this Unified Theory. As a first step in my algebraic study of logic programming, I propose a shallow embedding of logic programs into Gofer programs. This embedding translates each Prolog predicate into a Gofer function such that both the declarative and the procedural reading of the Prolog predicate are preserved. In the standard approach to mapping logic programs to functional ones the declarative reading is lost. The shallow embedding computes by means of operations on lazy lists. The state of each step in computation is passed on as a list of substitutions, and all the implicit logic operators in Prolog are replaced by explicit Gofer operators on lists. I express a set of algebraic laws for these operators and discuss how...

### Exploiting Logic Program Schemata to Teach Recursive Programming

"... Abstract. Recursion is a complex concept that most novice logic programmers have difficulty grasping. Problems associated with recursion are avoided in imperative languages where iteration is provided as an alternative to recursion. Although difficult to learn, recursion is very easy to use once it ..."

Abstract
- Add to MetaCart

Abstract. Recursion is a complex concept that most novice logic programmers have difficulty grasping. Problems associated with recursion are avoided in imperative languages where iteration is provided as an alternative to recursion. Although difficult to learn, recursion is very easy to use once it is understood. In fact, many problems that have straightforward recursive solutions have very sophisticated iterative solutions. Many of the difficulties associated with learning recursion can be overcome by incorporating conditional recursion (i.e., a structured recursive equivalent to the WHILE loop) into logic programming languages. Two popular instructional techniques are collaborative learning and situated learning. The underlying claim of the situated cognition movement is the desire to enculturate the student into the domain of the teacher by involving the student in a series of authentic activities which are designed to incrementally improve the skills of the student. In the domain of computer programming, collaboration is an authentic activity. In this paper, we present logic program templates and schemata which add conditional recursion to logic programming languages and enable collaborative logic programming. Conditional recursion also provides a bridge to higher-order programming. Higher-order programming is the essence of abstraction in problem solving. Thus, in addition to aiding its students in acquiring the knowledge of recursion, conditional recursion also promotes abstract problem solving skills. We have successfully employed this schema-based approach to teaching recursion in several declarative programming languages with much success over the past four years. 1