tree constant. Hint: you might use 'univ', or its cousins.
?- postorder(a(b,c,d(e,f,g))).
b c e f g d a true
Hi ,
I am trying this problem but , the output is undefined predicate postorder. I think i wrote correctly but, it is not working.
postorder(void,[])...
Write a predicate 'everyother' which will remove every other element in a list,
starting with the second element. List length can be odd or even.
e.g. ?- everyother([g,r,o,u,l,l,o,e,r,s,p],L).
L = [g,o,l,o,r,p];
i am trying like this
remove([_,_],[]).
remove([H,H|T],R):-...
e.g. ?-addbubba([a,b,c],X).
X=[a,bubba,b,bubba,c,bubba]
I tried like this..
addbubba([],[]).
addbubba([X|Y],[A|B]):- not(integer(X)), isList(Y),A = X,addbubba(Y,B),append(B,'bubba',K).
pls help its urgent...
Create a binary predicate called 'square' which will square each
number in a list. This pred. will be shallow.
e.g. ?-square([a,[[3]],b,4,c(5),8],X).
X=[a,[[3]],b,16,c(5),64]
Need help.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.