2012-02-13から1日間の記事一覧

Problem 20

(require 'calc-ext) (defvar calc-command-flags nil) (defun factorial (n) (let ((rst 1)) (while (math-lessp 0 n) (setq rst (math-mul rst n)) (setq n (math-sub n 1)) ) rst )) (defun digit-sum (n) (let* ((str (math-format-value n)) (len (leng…

Problem 19

(defvar month-day-alist '((1 . 31) (2 . 28) (3 . 31) (4 . 30) (5 . 31) (6 . 30) (7 . 31) (8 . 31) (9 . 30) (10 . 31) (11 . 30) (12 . 31))) (defun assq-val (key alist) (cdr (assq key alist))) (defun next-month (year month day) (let ((days (…