unit upoly;

interface
  type
    termo = record
                  coeficiente :real;
                  expoente    :integer;
                end;

     tElemento=^termo;
     tLista   = ^nodo;
     nodo     =  record
                    info   : tElemento;
                    proximo: tLista;
                 end;

                 
    function vazia(Lista:tLista):boolean;
    function NovoPoly:tLista;
    function head(Lista:tLista):tElemento;
    function tail(Lista:tLista):tLista;
    function inserir(X:tElemento; Lista:tLista):tLista;

    function  CriarTermo (coeficiente :real; expoente:integer):tElemento;
    function  Coef(termo:tElemento):real;
    function Expo(termo:tElemento):integer;
implementation

function  Coef(termo:tElemento):real;
begin
    Coef:=termo^.coeficiente;
end;

function Expo(termo:tElemento):integer;
begin
   Expo:=termo^.expoente;
end;


 function  CriarTermo (coeficiente :real; expoente:integer):tElemento;
     var  termo:tElemento;
 begin
     new(termo);
     termo^.coeficiente:=coeficiente;
     termo^.expoente:=expoente;
     CriarTermo:=termo
 end;







 function inserir(X:tElemento; Lista:tLista):tLista;
    var p:tLista;
 begin
    new(P);
    p^.info:=X;
    p^.proximo:=Lista;
    Lista:=p;
    inserir:=Lista;

 end;


 function NovoPoly:tLista;
 begin
    NovoPoly := Nil
 end;
 function vazia(Lista:tLista):boolean;
 begin
     vazia:= (Lista = Nil)
 end;

 function head(Lista:tLista):tElemento;
 begin
     head :=Lista^.info;
 end;
 function tail(Lista:tLista):tLista;
 begin
    tail:= Lista^.proximo;
 end;
end.
