Functional programing and the logical variable

  • Authors:
  • Gary Lindstrom

  • Affiliations:
  • Department of Computer Science, University of Utah, Salt Lake City, Utah

  • Venue:
  • POPL '85 Proceedings of the 12th ACM SIGACT-SIGPLAN symposium on Principles of programming languages
  • Year:
  • 1985

Quantified Score

Hi-index 0.00

Visualization

Abstract

Logic programming offers a variety of computational effects which go beyond those customarily found in functional programming languages. Among these effects is the notion of the “logical variable.” i.e. a value determined by the intersection of constraints, rather than by direct binding. We argue that this concept is “separable” from logic programming, and can sensibly be incorporated into existing functional languages. Moreover, this extension appears to significantly widen the range of problems which can efficiently be addressed in function form, albeit at some loss of conceptual purity. In particular, a form of side-effects arises under this extension, since a function invocation can exert constraints on variables shared with other function invocations. Nevertheless, we demonstrate that determinacy can be retained, even under parallel execution. The graph reduction language FGL is used for this demonstration, by being extended to a language FGL+LV permitting formal parameter expressions, with variables occurring therein bound by unification. The determinacy argument is based on a novel dataflow-like rendering of unification. In addition the complete partial order employed in this proof is unusual in its explicit representation of demand, a necessity given the “benign” side-effects that arise. An implementation technique is suggested, suitable for reduction architectures.