Sha256: 2acf850f387b1cb29784974a256a07b90b41e0a42fe593934f62e85c4e151838

Contents?: true

Size: 541 Bytes

Versions: 396

Compression:

Stored size: 541 Bytes

Contents

;;; difference-of-squares.el --- Difference of Squares (exercism)

;;; Commentary:

;;; Code:
(eval-when-compile (require 'cl))

(defun sum-of-squares (n)
  "Square of sums of N."
  (reduce #'+ (mapcar #'(lambda (i) (expt i 2)) (number-sequence 1 n))))

(defun square-of-sums (n)
  "Sum of squares of N."
  (expt (reduce #'+ (number-sequence 1 n)) 2))

(defun difference (n)
  "Difference of squares pertaining to N."
  (- (square-of-sums n)
     (sum-of-squares n)))

(provide 'difference-of-squares)
;;; difference-of-squares.el ends here

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.0.6.20 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.19 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.18 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.17 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.16 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.15 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.14 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.13 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.12 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.11 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.10 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.9 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.8 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.7 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.6 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.5 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.4 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.3 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.2 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.6.1 tracks/elisp/exercises/difference-of-squares/example.el