Sha256: c6ed2b234303b56838a655a36d81a1219e8ea4071b4704a85fd2eb307497580c

Contents?: true

Size: 363 Bytes

Versions: 216

Compression:

Stored size: 363 Bytes

Contents

;;; grains.el --- Grains exercise (exercism)

;;; Commentary:

;;; Code:

(require 'cl)

(defun square (n)
  "Find the number of grains on square N."
  (string-to-number (calc-eval (format "2^(%d - 1)" n))))

(defun total ()
  "Find the total number of grains on the board."
  (string-to-number (calc-eval "2^64 - 1")))

(provide 'grains)
;;; grains.el ends here

Version data entries

216 entries across 216 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.138 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.137 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.136 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.135 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.134 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.133 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.132 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.131 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.130 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.129 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.128 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.127 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.126 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.125 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.124 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.123 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.122 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.121 tracks/elisp/exercises/grains/example.el
trackler-2.2.1.120 tracks/elisp/exercises/grains/example.el