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 situ...
Main Authors: | , , |
---|---|
Format: | Article |
Language: | English |
Published: |
Open Publishing Association
2019-09-01
|
Series: | Electronic Proceedings in Theoretical Computer Science |
Online Access: | http://arxiv.org/pdf/1907.11354v2 |
_version_ | 1818037691165442048 |
---|---|
author | Paul Tarau Jan Wielemaker Tom Schrijvers |
author_facet | Paul Tarau Jan Wielemaker Tom Schrijvers |
author_sort | Paul Tarau |
collection | DOAJ |
description | 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 extensions |
first_indexed | 2024-12-10T07:30:52Z |
format | Article |
id | doaj.art-996cc3f57d7540a0a068e90b570a989b |
institution | Directory Open Access Journal |
issn | 2075-2180 |
language | English |
last_indexed | 2024-12-10T07:30:52Z |
publishDate | 2019-09-01 |
publisher | Open Publishing Association |
record_format | Article |
series | Electronic Proceedings in Theoretical Computer Science |
spelling | doaj.art-996cc3f57d7540a0a068e90b570a989b2022-12-22T01:57:34ZengOpen Publishing AssociationElectronic Proceedings in Theoretical Computer Science2075-21802019-09-01306Proc. ICLP 201922423710.4204/EPTCS.306.26:16Lazy Stream Programming in PrologPaul TarauJan WielemakerTom SchrijversIn 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 extensionshttp://arxiv.org/pdf/1907.11354v2 |
spellingShingle | Paul Tarau Jan Wielemaker Tom Schrijvers Lazy Stream Programming in Prolog Electronic Proceedings in Theoretical Computer Science |
title | Lazy Stream Programming in Prolog |
title_full | Lazy Stream Programming in Prolog |
title_fullStr | Lazy Stream Programming in Prolog |
title_full_unstemmed | Lazy Stream Programming in Prolog |
title_short | Lazy Stream Programming in Prolog |
title_sort | lazy stream programming in prolog |
url | http://arxiv.org/pdf/1907.11354v2 |
work_keys_str_mv | AT paultarau lazystreamprogramminginprolog AT janwielemaker lazystreamprogramminginprolog AT tomschrijvers lazystreamprogramminginprolog |