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.0.5 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.0.4 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.0.3 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.0.2 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.0.1 tracks/elisp/exercises/difference-of-squares/example.el
trackler-2.0.0.0 tracks/elisp/exercises/difference-of-squares/example.el
trackler-1.0.4.1 tracks/elisp/exercises/difference-of-squares/example.el
trackler-1.0.4.0 tracks/elisp/exercises/difference-of-squares/example.el
trackler-1.0.3.0 tracks/elisp/exercises/difference-of-squares/example.el
trackler-1.0.2.1 tracks/elisp/exercises/difference-of-squares/example.el
trackler-1.0.2.0 tracks/elisp/exercises/difference-of-squares/example.el
trackler-1.0.1.2 tracks/elisp/exercises/difference-of-squares/example.el
trackler-1.0.1.1 tracks/elisp/exercises/difference-of-squares/example.el
trackler-1.0.1.0 tracks/elisp/exercises/difference-of-squares/example.el
trackler-1.0.0.1 tracks/elisp/exercises/difference-of-squares/example.el
trackler-1.0.0 tracks/elisp/exercises/difference-of-squares/example.el