prolog中的流推理/反应式编程? [英] Stream reasoning / Reactive programming in prolog?

查看:56
本文介绍了prolog中的流推理/反应式编程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道您是否知道使用 prolog 进行流处理的任何方式,即某种反应式编程,或者至少让查询在不断更新的知识库(实际上是流)上运行,并不断输出推理的输出?

I was wondering if you know of any way to use prolog for stream processing, that is, some kind of reactive programming, or at least to let a query run on a knowledge base that is continuously updated (effectively a stream), and continuously output the output of the reasoning?

在流行的序言"中实现了什么,例如 SWI-prolog?

Anything implemented in the popular "prologs", such as SWI-prolog?

推荐答案

您可以使用 Logtalk 对事件驱动编程的支持来定义监视知识库更新事件并做出相应反应的监视器.您可以使用大多数 Prolog 系统作为支持的编译器运行 Logtalk,包括 SWI-Prolog.

You can use Logtalk's support for event-driven programming to define monitors that watch for knowledge base update events and react accordingly. You can run Logtalk using most Prolog systems as the backed compiler, including SWI-Prolog.

描述了事件驱动的功能,例如在用户手册中:http://logtalk.org/manuals/userman/events.html

The event-driven features are described e.g. in the user manual: http://logtalk.org/manuals/userman/events.html

当前发行版包含一些使用事件和监视器的示例.考虑到您的问题,一个有趣的例子是 bricks 示例:https://github.com/LogtalkDotOrg/logtalk3/tree/master/examples/bricks

The current distribution contains some examples of using events and monitors. An interesting one considering your question is the bricks example: https://github.com/LogtalkDotOrg/logtalk3/tree/master/examples/bricks

首先运行此示例,然后查看其代码,您应该可以很好地了解如何处理系统范围的事件和监视器.

Running this example first and then looking at its code should give you as good idea of what you can do with system wide events and monitors.

这篇关于prolog中的流推理/反应式编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆