language: Prolog (swi) (swipl 5.6.64)
date: 128 days 14 hours ago
link:
可見度: public
1
2
3
4
5
6
7
8
9
10
nalezy( X,[X|_] ).
nalezy( X,[H|T] ) :- nalezy( X,T ).
 
usun(X,[X|Reszta],Reszta).
usun(X,[Y|Ogon],[Y|Reszta]) :-
        usun(X,Ogon,Reszta).
 
sprawdz([H|T]):- nalezy(H,T)->usun(H,T);sprawdz(T).
 
powt(A):- sprawdz(A), writeln(A).
  • upload with new input
  • 結果: Success     time: 0.02s    記憶體: 6204 kB     回傳值: 0

    powt([1,2,3,4]).
    Warning: /home/LPPf5l/prog.pl:2:
    	Singleton variables: [H]
    
    false.