17 lines
542 B
Plaintext
17 lines
542 B
Plaintext
IMPLEMENTATION Sequences
|
|
|
|
IMPORT Nat COMPLETELY
|
|
IMPORT Seq[nat] COMPLETELY
|
|
IMPORT Real COMPLETELY
|
|
IMPORT Seq[real] COMPLETELY
|
|
|
|
DEF scalar == \\s1,s2 . IF <>?(s1) THEN 0 ELSE IF <>?(s2) THEN 0 ELSE ft(s1)*ft(s2)+scalar(rt(s1),rt(s2)) FI FI
|
|
|
|
DEF genList == \\n . IF n=0 THEN <> ELSE n::genList(n-1) FI
|
|
|
|
DEF horner == \\k,x . LET k1 == ft(k)
|
|
k2 == ft(rt(k))
|
|
k3 == ft(rt(rt(k)))
|
|
k4 == ft(rt(rt(rt(k))))
|
|
IN (((k1)*x+k2)*x+k3)*x+k4
|