Logo 
Search:

Artificial Intelligence Forum

Ask Question   UnAnswered
Home » Forum » Artificial Intelligence       RSS Feeds

PROLOG

  Asked By: Izzy    Date: Mar 19    Category: Artificial Intelligence    Views: 816
  

given a list of facts such as
task(a,5).
task(b,4).
task(c,1).
task(d,7).

How would you define a predicate with a rule that will enable you to find the total time of the tasks. the integers in the facts stand for the time allocated for each task e.g.

lets call this predicate i want to define add:

?- add([a,b,c],TotalTime).
Prolog should resond with

TotalTime=10.

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on PROLOG Or get search suggestion and latest updates.




Tagged: