从数据库返回值-Prolog
早上好,我正在学习prolog。 但是我已经搜索过,但是我没有找到解决方案,它一定很简单,但是我被卡住了,
我创建了一个数据库,如以下
data base([
movie(["Titanic"], [["Jack", "Dawson"] ,["Rose", "DeWitt", "Bukater"]], ["James","Cameron"] ),
movie(["Hulk"], [["Bruce", "Banner"] ,["Betty", "Ross"]], ["Ang","Lee"] )
]).
数据库包含电影的名称,主要角色的名称,然后是导演。
目标是创建一个函数:
示例
find_movies_by_character(“ Bruce Banner”) 需要回报泰坦尼克号
,我想可能有问题,我愿意接受新想法
Good morning, I'm learning prolog.
But I already searched, but I didn't find a solution, it must be very simple, but I got stuck
I created a database like the following
data base([
movie(["Titanic"], [["Jack", "Dawson"] ,["Rose", "DeWitt", "Bukater"]], ["James","Cameron"] ),
movie(["Hulk"], [["Bruce", "Banner"] ,["Betty", "Ross"]], ["Ang","Lee"] )
]).
This database contains the name of the film, the name of the main characters and then the director.
The goal would be to create a function:
Example
find_movies_by_character("Bruce Banner")
Need return Titanic
I imagine something might be wrong, I'm open to new ideas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
数据库([
带有该空间,在SWI Prolog中似乎不是有效的语法。无论您从哪里得到它?更具体地说,数据库包含一个包含电影术语的列表,每个列表包含一个包含电影名称的列表,以及(包含主要字符名称部分列表的列表)和(包含董事名称的部分的列表)。
从写出的内容是多么复杂,至少与之合作会很复杂。如果您可以简化它,它将变得更容易使用:
例如
data base([
with that space in it, doesn't seem to be valid syntax in SWI Prolog. Wherever did you get that from?More specifically, the database contains a list containing movie terms, each containing a list containing the name of the film and (a list containing lists of parts of names of the main characters) and (a list containing parts of names of directors).
From how complicated it is to write out, it will be at least that complicated to work with. If you can simplify it, it will get easier to work with:
e.g.