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