Counting, Highest Value, No Same Output
- From: justganu@xxxxxxxxx
- Date: 8 Oct 2005 21:11:07 -0700
hi all... thans for dropping by here... but hope u can help me.... this
is my problem.... in prolog how can we have:
1. counting..... say we wanna count the number of pc type computer from
a given facts:
price(pc,1000.00).
price(pc,2000.00).
price(laptop,3000.00).
price(pc,4000.00).
so, the output(answer) should be 3 that is ther r 3 computers which
type is pc.
2. highest value... say we wanna find a computer with the highest price
from the given facts.... so, the output(answer) should be pc
4000.00......
3. prevent same output..... say we wanna display out who likes to eat
fish... facts:
likes(joe,tuna).
likes(jane,mackerel).
likes(joe,mackerel).
likes(dean,chicken).
likes(jane,finch).
foodtype(tuna,fish).
foodtype(mackerel,fish).
foodtype(chicken,bird).
foodtype(finch,bird).
so, how can i have the correct output without having the same value
more than one....that is:
Who = joe
who = jane
NOT
Who = joe
Who = jane
Who = joe // dont want this cuz it has appeared before.
i realy hope u can help me solving this things....n i preceded with
million thans....
.
- Follow-Ups:
- Re: Counting, Highest Value, No Same Output
- From: Bart Demoen
- Re: Counting, Highest Value, No Same Output
- From: Roland Illig
- Re: Counting, Highest Value, No Same Output
- Prev by Date: Re: Challenging problem
- Next by Date: Re: Counting, Highest Value, No Same Output
- Previous by thread: Canna Prolog - Prolog for .Net
- Next by thread: Re: Counting, Highest Value, No Same Output
- Index(es):
Relevant Pages
|
|