users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Prolog Mystery


From: Salvador Abreu
Subject: Re: Prolog Mystery
Date: Wed, 26 Dec 2001 23:39:14 +0000

> I'm trying to do a predicate that given a list collects all
> elements into another list that are not integer.
> I've done the following:
> 
> np_collect([],X,X).
> np_collect([Y|L], T, P) :- 
>       \+ integer(Y),
>       np_add(Y, T, R),
>       np_collect(L, R, P).
> 
> 
> For some strange reason it is not working...

you'd need a third recursive clause, starting with integer(Y)...

btw, is this for some course assignment?

>         Hope you had a great Christmas and a Happy New Year...

yes and not yet :-)
../s



reply via email to

[Prev in Thread] Current Thread [Next in Thread]