Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
これは、これまでのところ、私が考えることができる .pro ファイルです。「thelist」の最初の出現(=最初の頭)を印刷/取得/出力したい。
thelist([a,b,c,d,e]). head(H,[H|T]).
常に常に NO を返すのはなぜですか? ありがとう
試す
... thelist([H|_]), write(H), nl, ...
この方法でも使用できるようです:
thelist(X),first(F,X).
ただし、以下のコードをナレッジ ベース (.pro ファイル) に追加する必要があります。
first(F,[F|_]).
を交換する
head(H,[H|T]).