为什么prolog不打印此列表

| 我在下面有一个序言规则
schedule(mary,[ma424,ma387,eng301]).
而且我有一个谓词
taking(X,Y):- schedule(X, [Y | L]). 
当我尝试通过键入来弄清楚她上什么课时
taking(mary,Y).
我越来越 y = ma424 为什么不打印出她所有的课 我也尝试过这个和其他变化
taking(X,Y):- schedule(X,[X|L]),schedule(Y, [Y | L]),schedule(Y,L),X\\=Y,X\\=L.
但它不起作用 如何获取打印所有类的方式,以定义规则     
已邀请:
这是由于您定义谓词的方式。
taking(X,Y) :-        % X takes class Y if...
    schedule(X,       % in the schedule for X,
             [Y|L]).  % Y is the first element.
如果您不告诉程序,程序将不会神奇地决定搜索列表ѭ5。为此,请使用
member/2
谓词:
taking(Student, Class) :-
    schedule(Student, Classes),
    member(Class, Classes).
    

要回复问题请先登录注册