PLUSPOL(a, b) :=
if a = ( ) then return b
else if b = ( ) then return a
else
ea := first first a
eb := first first b
ca := second first a %a=((ea ca) ...)
cb := second first b %b=((eb cb) ...)
return(
if ea > eb then
cons(first a, pluspol(rest a, b))
else if ea < eb then
cons(first b, pluspol(rest b, a))
else if ca + cb = 0 then
pluspol(rest a, rest b)
else cons(list(ea, ca + cb), pluspol(rest a, rest b))
fi fi fi)
fi fi
TIMESPOL(a, b) :=
if a = ( ) or b = ( ) then return ( )
else
ea := first first a
eb := first first b
ca := second first a %a=((ea ca) ...)
cb := second first b %b=((eb cb) ...)
return(cons(list(ea + eb, ca * cb),
pluspol(timespol(list first a, rest b),
timespol(rest a, b))
)
)
fi