From eb8a5e9b13d1536dc7a9ac8795917dd768a372ed Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 23 May 2011 20:36:06 -0700 Subject: [PATCH] Small cleanup of recent 5x5.el changes. * lisp/play/5x5.el (5x5-log-init, 5x5-log): Evaluate when compiling. (5x5-log-init, 5x5-log, 5x5-solver): Doc fixes. (math-map-vec, math-sub, math-mul, math-make-intv, math-reduce-vec) (math-format-number, math-pow, calcFunc-arrange, calcFunc-cvec) (calcFunc-diag, calcFunc-trn, calcFunc-inv, calcFunc-mrow) (calcFunc-mcol, calcFunc-vconcat, calcFunc-index): Declare. --- lisp/ChangeLog | 9 +++++++++ lisp/play/5x5.el | 26 ++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ce0f3e8733b..3f050faee13 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2011-05-24 Glenn Morris + + * play/5x5.el (5x5-log-init, 5x5-log): Evaluate when compiling. + (5x5-log-init, 5x5-log, 5x5-solver): Doc fixes. + (math-map-vec, math-sub, math-mul, math-make-intv, math-reduce-vec) + (math-format-number, math-pow, calcFunc-arrange, calcFunc-cvec) + (calcFunc-diag, calcFunc-trn, calcFunc-inv, calcFunc-mrow) + (calcFunc-mcol, calcFunc-vconcat, calcFunc-index): Declare. + 2011-05-24 Stefan Monnier Add an :exit-function for completion-at-point. diff --git a/lisp/play/5x5.el b/lisp/play/5x5.el index a5f585d4d86..75f7c2df009 100644 --- a/lisp/play/5x5.el +++ b/lisp/play/5x5.el @@ -490,6 +490,7 @@ position." (cdr x)))) (cdr grid-matrix)))) +(eval-and-compile (if nil; set to t to enable solver logging (progn (defvar 5x5-log-buffer nil) @@ -499,7 +500,7 @@ position." (setq 5x5-log-buffer (get-buffer-create "*5x5 LOG*")))) (defun 5x5-log (name value) - "Debug purpuse only. + "Debug purposes only. Log a matrix VALUE of (mod B 2) forms, only B is output and Scilab matrix notation is used. VALUE is returned so that it is @@ -516,19 +517,36 @@ easy to log a value with minimal rewrite of code." (insert name ?= value-to-log ?\n)))) value)) (defmacro 5x5-log-init ()) - (defmacro 5x5-log (name value) value)) + (defmacro 5x5-log (name value) value))) + +(declare-function math-map-vec "calc-vec" (f a)) +(declare-function math-sub "calc" (a b)) +(declare-function math-mul "calc" (a b)) +(declare-function math-make-intv "calc-forms" (mask lo hi)) +(declare-function math-reduce-vec "calc-vec" (a b)) +(declare-function math-format-number "calc" (a &optional prec)) +(declare-function math-pow "calc-misc" (a b)) +(declare-function calcFunc-arrange "calc-vec" (vec cols)) +(declare-function calcFunc-cvec "calc-vec" (obj &rest dims)) +(declare-function calcFunc-diag "calc-vec" (a &optional n)) +(declare-function calcFunc-trn "calc-vec" (mat)) +(declare-function calcFunc-inv "calc-misc" (m)) +(declare-function calcFunc-mrow "calc-vec" (mat n)) +(declare-function calcFunc-mcol "calc-vec" (mat n)) +(declare-function calcFunc-vconcat "calc-vec" (a b)) +(declare-function calcFunc-index "calc-vec" (n &optional start incr)) (defun 5x5-solver (grid) "Return a list of solutions for GRID. Given some grid GRID, the returned a list of solution LIST is -sorted from least Hamming weight to geatest one. +sorted from least Hamming weight to greatest one. LIST = (SOLUTION-1 ... SOLUTION-N) Each solution SOLUTION-I is a cons cell (HW . G) where HW is the Hamming weight of the solution --- ie the number of strokes to -achieves it --- and G is the grid of positions to click in order +achieve it --- and G is the grid of positions to click in order to complete the 5x5. Solutions are sorted from least to greatest Hamming weight." -- 2.39.2