emacs-super-duper-yes-or-no

Replace the yes-or-no function with an even more demanding yes or no prompt, rather than with y-or-n.
Log | Files | Refs | LICENSE

commit a2b536689499a4a388b6da5ef77be724b6b54c9c
parent 005444b97f92bbe7b73a52cc924016471848e7d9
Author: Yuval Langer <yuvallangerontheroad@gmail.com>
Date:   Thu,  5 Oct 2023 01:46:58 +0300

Add some arithmetic problem functions and variables.

Diffstat:
Msuper-duper-yes-or-no.el | 28++++++++++++++++++++++++++++
1 file changed, 28 insertions(+), 0 deletions(-)

diff --git a/super-duper-yes-or-no.el b/super-duper-yes-or-no.el @@ -46,6 +46,12 @@ (defvar sd-number-of-case-toggle-characters 4) +(defvar sd-arithmetic-problem-minimum + 0) + +(defvar sd-arithmetic-problem-maximum + 10) + (defun sd--randint (minimum maximum) "Returns an integer between MINIMUM (inclusive) and MAXIMUM (exclusive)." @@ -232,6 +238,28 @@ wanted-input-no) nil))))) +(defun sd--make-arithmetic-problem-number () + (sd--randint sd-arithmetic-problem-minimum + (1+) sd-arithmetic-problem-maximum)) + +(defun sd--make-arithmetic-problem-arguments (argument-list) + (cond + ((null argument-list) + '()) + ((atom (car argument-list)) + (cons (sd--make-arithmetic-problem-number) + (sd--make-arithmetic-problem-arguments + (cdr argument-list)))) + (t (cons (sd--make-arithmetic-problem + (car argument-list)) + (cdr argument-list))))) + +(defun sd--make-arithmetic-problem (arithmetic-expression-template) + (cond + ((null arithmetic-expression-template) '()) + (t (cons (car arithmetic-expression-template) + (sd--make-arithmetic-problem-arguments (cdr arithmetic-expression-template)))))) + ;; Local Variables: ;; read-symbol-shorthands: (("sd-" . "super-duper-yes-or-no-")) ;; End: