Handbook
Glossary
sum-of-squares ( seq -- x )
Vocabulary
math
.
statistics
Inputs
seq
an
object
Outputs
x
an
object
See also
sum-of-cubes
,
sum-of-quads
Definition
IN:
math.statistics
GENERIC:
sum-of-squares
( seq -- x )
Methods
USING:
accessors
kernel
math
math.statistics
sequences
;
M:
iota
sum-of-squares
n>>
1
-
[
]
[
1
+
]
[
1/2
+
]
tri
*
*
3
/
;
USING:
kernel
math
math.statistics
sequences
;
M:
object
sum-of-squares
[
sq
]
map-sum
;
USING:
accessors
combinators.short-circuit
generic
kernel
math
math.statistics
ranges
sequences
;
M:
range
sum-of-squares
dup
{
[
step>>
1
=
]
[
from>>
integer?
]
}
1&&
[
[
from>>
]
[
length>>
]
bi
dupd
+
[
<iota>
sum-of-squares
]
bi@
swap
-
]
[
M\
range
sum-of-squares
(call-next-method)
]
if
;