Handbook
Glossary
ptrim ( p -- q )
Polynomials
Prev:
pextend-conv ( p q -- p' q' )
Next:
2ptrim ( p q -- p' q' )
Vocabulary
math
.
polynomials
Inputs
p
a polynomial
Outputs
q
a polynomial
Word description
Trims excess zeros from a polynomial.
Examples
USING: math.polynomials prettyprint ; { 0 1 0 0 } ptrim .
{ 0 1 }
Definition
USING:
kernel
math
sequences
;
IN:
math.polynomials
:
ptrim
( p -- q )
dup
length
1
=
[
[
zero?
]
trim-tail
]
unless
;