When I am running that code it is stil only displaying the first car clause.
So for this
cars('Camery','Hiyundi','1980',500,'2l').
I want the fourth paramater the 500 in this case to be compared against all the other cars power and then show the least powered car. So it would show when i run...
Ok, when i run the program and try the least, it is only displaying the first one of these
cars('Camery','Hiyundi','1980',500,'2l').
cars('Ford XL','Hiyundi','1950',900,'5l').
cars('Tourino','Ford','1920',450,'3l').
cars('Wagon','Ford','1975',1020,'2l').
cars('V8...
I meant in the previous post, its not ordering them its only giving the list without it being the least powerful car.
Its only showing the first clause of cars regardless that it isn't the last powerful car....
It does not seem to be working however, it is only outputting the first car..
Also can you please explain bagof()
Wow I didn't realize there was those functions... Is their a good place to learn these function and that explains them for SWI-prolog.
Cheers, Kazzal
I don't understand though its still not working, It gives no error now which is great but it does not seem to be proceeding with this line.
Z is P,
here is the code updated once again
% finds the least powerful car.
least:-
write('The least powerful car is '),
Z is 1,
N = car,
!,
nl...
I am having trouble with this code, are you able to assign a variable to a string or is IS reserved for a comparison or something?
Here is the code, Im just trying to make the internal goal "least" show the least powerful car.
% cars/5.
% cars(BRAND,MANUFACTURER,YEAR,POWER,ENGINE)...
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.