1
以下事实表示这种格式序言中比较和数据过滤
%% movie(title , star, genre, gross)
movie(battle_los_angeles, aaron_eckhart, action, 13500000).
movie(rango, johnny_depp, animation, 51100000).
movie(red_riding_hood, amanda_seyfried, fantasy, 5300000).
movie(the_adjustment_bureau, matt_damon, sci_fi, 30400000).
movie(mars_needs_moms, seth_green, animation, 1700000).
movie(beastly, alex_pettyfer, romance, 13600000).
movie(hall_Pass, owen_wilson, comdey, 31300000).
movie(just_go_with_it, adam_sandler, comedy, 91200000).
movie(unknown, liam_neeson, thriller, 56000000).
movie(the_king_speech, colin_Firth, history, 126400000).
- 定义的规则,只有返回电影的所有冠军,在票房前10部电影。
- 定义一个规则,只返回所有的电影明星。
- 定义返回具有相同流派的电影标题的规则。
- 定义一个规则,根据总共 两个电影名称进行比较。
我的解决方案至今是:
domains
s=symbol
predicates
nondeterm movie(s,s,s,integer)
nondeterm title(s)
nondeterm star(s)
clauses
%% movie(title , star, genre, gross)
movie(battle_los_angeles, aaron_eckhart, action,13500000).
movie(rango, johnny_depp, animation, 51100000).
movie(red_riding_hood, amanda_seyfried, fantasy,5300000).
movie(the_adjustment_bureau, matt_damon, sci_fi,30400000).
movie(mars_needs_moms, seth_green, animation,1700000).
movie(beastly, alex_pettyfer, romance,13600000).
movie(hall_Pass, owen_wilson, comdey,31300000).
movie(just_go_with_it, adam_sandler, comedy, 91200000).
movie(unknown, liam_neeson, thriller, 56000000).
movie(the_king_speech, colin_Firth, history, 126400000).
title(X):-movie(X,_,_,_).
star(X):-movie(_,X,_,_).
goal
star(X).
我试图解决的最后两分,但我不知道怎么...
- 定义返回标题的规则具有相同流派的电影。
- 定义一个规则,根据总共 两个电影名称进行比较。
谢谢U,做ü有序言的良好来源,我使用Visual序言 – xsari3x
你做他的所有功课!但看起来不错 – DaveEdelstein