Help prolog "NEWBIE"

From: Riccardo (ricky_diabolos_at_hotmail.com)
Date: 02/06/04

  • Next message: Riccardo: "Help prolog "NEWBIE""
    Date: 6 Feb 2004 12:20:26 -0800
    
    

    Hi guys! I need a hand from anyone that knows something about prolog
    , I will have an oral test where I had to explain this project.

    -----------------------------------------------------------------------------
    Define a predicate in PROLOG call averStud that
    applied on a student ID number 'Matr' and on a
    list of exams LE give as result the average AV of his votes.
    Every exam shuold be represented by a term of list LE like the
    following form ' exam(Matr,Exam,Vote).'
    -------------------------------------------------------------------------

    i have the solution , but i need help with the comment!
    Thx in advice.

    Solution:

    averStud(S,L,AV) :-
    totStud(S,L,N,T),
    N > 0,
    AV is T/N.
    totStud(_,[],0,0) :- !.
    totStud(S,[esame(S,_,V)|R],N,T) :- !,
    totStud(S,R,NN,TT),
    N is NN + 1, T is TT + V.
    totStud(S,[_|R],N,T) :-
    totStud(S,R,N,T).


  • Next message: Riccardo: "Help prolog "NEWBIE""

    Relevant Pages

    • Help prolog "NEWBIE"
      ... I need a hand from anyone that knows something about prolog ... I will have an oral test where I had to explain this project. ... list of exams LE give as result the average AV of his votes. ... Every exam shuold be represented by a term of list LE like the ...
      (comp.lang.prolog)
    • Re: Help prolog "NEWBIE"
      ... In message, Riccardo ... I need a hand from anyone that knows something about prolog ... I will have an oral test where I had to explain this project. ... >Every exam shuold be represented by a term of list LE like the ...
      (comp.lang.prolog)