blob: 4b7e452c2099da7410f6350f220d2a230f530552 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
;;; difference-of-squares.el --- Difference of Squares (exercism)
;;; Commentary:
;;; Code:
(require 'cl)
(defun square-of-sum (n)
(cl-loop for i from 1 to n
sum i into s
finally return (* s s)))
(defun sum-of-squares (n)
(cl-loop for i from 1 to n
sum (* i i)))
(defun difference (n)
(- (square-of-sum n) (sum-of-squares n)))
(provide 'difference-of-squares)
;;; difference-of-squares.el ends here
|