For Programmers: Free Programming Magazines  


Home > Archive > Prolog > February 2006 > how I can calculate the minimum of the tuplos?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how I can calculate the minimum of the tuplos?
Ricardo Nuno

2006-02-22, 1:23 am

%this one calculate the maximum of a list of tuplos
maxTuplo([],_,0).
maxTuplo([ [Nome,NumeroVoos]|Resto],Nome,NumeroVoos
):-
maxTuplo(Resto,_,MaxNumero),NumeroVoos >= MaxNumero.

maxTuplo([ [_,NumeroVoos]|Resto],Nome,MaxNumero):-
maxTuplo(Resto,Nome,MaxNumero),NumeroVoo
s < MaxNumero.

%maxTuplo([[porto, 7], [londres, 11], [madrid, 7], [paris, 7]],X,N).
X=londres
N=11


Can anyone help?

thanks in advance
Ricardo Nuno
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com