709 research outputs found
Lazy Stream Programming in Prolog
In recent years, stream processing has become a prominent approach for
incrementally handling large amounts of data, with special support and
libraries in many programming languages. Unfortunately, support in Prolog has
so far been lacking and most existing approaches are ad-hoc. To remedy this
situation, we present lazy stream generators as a unified Prolog interface for
stateful computations on both finite and infinite sequences of data that are
produced incrementally through I/O and/or algorithmically.
We expose stream generators to the application programmer in two ways: 1)
through an abstract sequence manipulation API, convenient for defining custom
generators, and 2) as idiomatic lazy lists, compatible with many existing list
predicates. We define an algebra of stream generator operations that extends
Prolog via an embedded language interpreter, provides a compact notation for
composing generators and supports moving between the two isomorphic
representations.
As a special instance, we introduce answer stream generators that encapsulate
the work of coroutining first-class logic engines and support interoperation
between forward recursive AND-streams and backtracking-generated OR-streams.
Keywords: lazy stream generators, lazy lists, first-class logic engines,
stream combinators, AND-stream / OR-stream interoperation, Prolog extensionsComment: In Proceedings ICLP 2019, arXiv:1909.0764
Logic programming in the context of multiparadigm programming: the Oz experience
Oz is a multiparadigm language that supports logic programming as one of its
major paradigms. A multiparadigm language is designed to support different
programming paradigms (logic, functional, constraint, object-oriented,
sequential, concurrent, etc.) with equal ease. This article has two goals: to
give a tutorial of logic programming in Oz and to show how logic programming
fits naturally into the wider context of multiparadigm programming. Our
experience shows that there are two classes of problems, which we call
algorithmic and search problems, for which logic programming can help formulate
practical solutions. Algorithmic problems have known efficient algorithms.
Search problems do not have known efficient algorithms but can be solved with
search. The Oz support for logic programming targets these two problem classes
specifically, using the concepts needed for each. This is in contrast to the
Prolog approach, which targets both classes with one set of concepts, which
results in less than optimal support for each class. To explain the essential
difference between algorithmic and search programs, we define the Oz execution
model. This model subsumes both concurrent logic programming
(committed-choice-style) and search-based logic programming (Prolog-style).
Instead of Horn clause syntax, Oz has a simple, fully compositional,
higher-order syntax that accommodates the abilities of the language. We
conclude with lessons learned from this work, a brief history of Oz, and many
entry points into the Oz literature.Comment: 48 pages, to appear in the journal "Theory and Practice of Logic
Programming
An Integrated Development Environment for Declarative Multi-Paradigm Programming
In this paper we present CIDER (Curry Integrated Development EnviRonment), an
analysis and programming environment for the declarative multi-paradigm
language Curry. CIDER is a graphical environment to support the development of
Curry programs by providing integrated tools for the analysis and visualization
of programs. CIDER is completely implemented in Curry using libraries for GUI
programming (based on Tcl/Tk) and meta-programming. An important aspect of our
environment is the possible adaptation of the development environment to other
declarative source languages (e.g., Prolog or Haskell) and the extensibility
w.r.t. new analysis methods. To support the latter feature, the lazy evaluation
strategy of the underlying implementation language Curry becomes quite useful.Comment: In A. Kusalik (ed), proceedings of the Eleventh International
Workshop on Logic Programming Environments (WLPE'01), December 1, 2001,
Paphos, Cyprus. cs.PL/011104
Lambda Calculus in Core Aldwych
Core Aldwych is a simple model for concurrent computation, involving the concept of agents which communicate through shared variables. Each variable will have exactly one agent that can write to it, and its value can never be changed once written, but a value can contain further variables which are written to later. A key aspect is that the reader of a value may become the writer of variables in it. In this paper we show how this model can be used to encode lambda calculus. Individual function applications can be explicitly encoded as lazy or not, as required. We then show how this encoding can be extended to cover functions which manipulate mutable variables, but with the underlying Core Aldwych implementation still using only immutable variables. The ordering of function applications then becomes an issue, with Core Aldwych able to model either the enforcement of an ordering or the retention of indeterminate ordering, which allows parallel execution
- …