Lazy Stream Programming in Prolog

被引:0
作者
Tarau, Paul
Wielemaker, Jan
Schrijvers, Tom
机构
关键词
lazy stream generators; lazy lists; first-class logic engines; stream combinators; AND-stream; OR-stream interoperation; Prolog extensions;
D O I
10.4204/EPTCS.306.26
中图分类号
TP301 [理论、方法];
学科分类号
081202 ;
摘要
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 corou-tining first-class logic engines and support interoperation between forward recursive AND-streams and backtracking-generated OR-streams.
引用
收藏
页码:224 / 237
页数:14
相关论文
共 20 条
[1]   Evaluation strategies for functional logic programming [J].
Antoy, S .
JOURNAL OF SYMBOLIC COMPUTATION, 2005, 40 (01) :875-903
[2]  
Babcock Brian, 2002, PODS, P1, DOI DOI 10.1145/543613.543615
[3]  
Beazley D., 2009, PYTHON ESSENTIAL REF
[4]  
Beck H, 2015, AAAI CONF ARTIF INTE, P1431
[5]  
Casas A, 2006, LECT NOTES COMPUT SC, V3945, P146
[6]  
Casas Amadeo, 2005, CICLOPS 2005
[7]  
HOLZBAUR C, 1992, LECT NOTES COMPUT SC, V631, P260, DOI 10.1007/3-540-55844-6_141
[8]  
Hudak P., 2007, P 3 ACM SIGPLAN C HI, P12, DOI DOI 10.1145/1238844.1238856
[9]   Relational Languages and Data Models for Continuous Queries on Sequences and Data Streams [J].
Law, Yan-Nei ;
Wang, Haixun ;
Zaniolo, Carlo .
ACM TRANSACTIONS ON DATABASE SYSTEMS, 2011, 36 (02)
[10]   NOTIONS OF COMPUTATION AND MONADS [J].
MOGGI, E .
INFORMATION AND COMPUTATION, 1991, 93 (01) :55-92