[英]prolog check if a list is in ascending order
我有一個清單,我想檢查是否已訂購。 有人可以指出我的錯誤嗎?
謝謝
taxinomemene([]).
taxinomemene([element1,element2|Tail]):-
stoixio1>stoixio12,
taxinomemene([stoixio2|Tail]).
如果您有單例列表,什么是stoixio1和stoixio12? 條件應根據element1和element2
is_sorted([]).
is_sorted([_]).
is_sorted([X,Y|T]) :-
X=<Y,
is_sorted([Y|T]).
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.