Code: Select all
(loop for x from 1 to 10
sum (* x x))
I clearly would like to write:
Code: Select all
(loop for x from 1 to 10
(expt (sum x) 2))
Btw, this is from Project Euler.
Any tips?
Code: Select all
(loop for x from 1 to 10
sum (* x x))
Code: Select all
(loop for x from 1 to 10
(expt (sum x) 2))
Code: Select all
(expt (loop for x from 1 to 10
sum x)
2)
Code: Select all
(loop for x from 1 to 10
sum x into sum
finally (return (expt sum 2)))