该计划旨在检查学生是否已取得指定的课程清单。但即使学生已经取得课程列表,它也显示为假。我做错了什么?
代码:
%Structure Of facts
%student(ID,FirstName,LastName,Advisor,CreditsPassed,GPA,CourseTakenList).
%courses_taken(CourseId,CourseTitle, Credit,Grade, NoOfTimesRepeated).
%Fact
student(20135639,'Sara','Haider','Mr. Hussain Al-Arrayed',98,3.95,
[courses_taken('ITCE418', 'PRODUCTIVITY WITH IS TECHNOLOGY',3,'A', 0),
courses_taken('MATHS101', 'CALCULUS I', 3,'A', 0),
courses_taken('ACC112', 'FINANCIAL ACCOUNTING I', 3, 'A', 0),
courses_taken('ECON140', 'MICROECONOMICS', 3,'A', 0),
courses_taken('ENGL219', 'TECHNICAL REPORT WRITING', 3,'A', 0) ] ).
check_prereq([],Id):- !.
check_prereq([course(P)]|T,Id):-
student(Id,_,_,_,_,_, CoursesTakenList),
member( courses_taken(P,_,_,_,_), CoursesTakenList),
check_prereq(T,Id).
以下查询应返回true,因为学生已参加这些课程
?- check_prereq([course('ITCE418'), course('ACC112')],20135639).
false.
我做错了吗?
答案 0 :(得分:0)
您需要替换:import React from 'react'
import ReactStreetview from 'react-streetview'
import { streetViewPanoramaOptions } from './constants.js'
const About = () => {
const googleMapsApiKey = 'myAPIkey'
return (
<div>
<div
style={{ .... }}
>
<ReactStreetview
apiKey={googleMapsApiKey}
streetViewPanoramaOptions={streetViewPanoramaOptions.hall}
/>
</div>
<div
style={{ .... }}
>
<ReactStreetview
apiKey={googleMapsApiKey}
streetViewPanoramaOptions={streetViewPanoramaOptions.firstRoom}
/>
</div>
<div
style={{ .... }}
>
<ReactStreetview
apiKey={googleMapsApiKey}
streetViewPanoramaOptions={streetViewPanoramaOptions.secondRoom}
/>
</div>
</div>
)
}
export default About
[course(P)]|T with [course(P)|T]
同样在第一行用 check_prereq([],_):- !.
check_prereq([course(P)|T],Id):-
student(Id,_,_,_,_,_, CoursesTakenList),
member( courses_taken(P,_,_,_,_), CoursesTakenList),
check_prereq(T,Id).
替换Id
(匿名变量)以消除警告(Singleton变量)。现在工作正常:
_
请注意,它返回true并要求更多解决方案返回false,但它会像我们预期的那样成功。