From 84b50eb38f6ffe2c454998318ca6e36a3123a3d5 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 7 Nov 2020 15:55:38 -0700 Subject: avoid using s-blank? Signed-off-by: Sean Whitton --- org-d20.el | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'org-d20.el') diff --git a/org-d20.el b/org-d20.el index 1aa4b7c..29bc283 100644 --- a/org-d20.el +++ b/org-d20.el @@ -417,13 +417,17 @@ the best N of them, e.g., 4d6k3." ;; Concat b onto a as a signed term, where a is possibly empty (defun org-d20--rolls-concat (sign a b) - (if (>= sign 0) - (if (s-blank? a) - b - (concat a " + " b)) - (if (s-blank? a) - (concat "- " b) - (concat a " - " b)))) + (let (strings) + (if (or (null a) (string= "" a)) + (unless (>= sign 0) + (push " - " strings)) + (push a strings) + (push (if (>= sign 0) + " + " + " - ") + strings)) + (push b strings) + (apply #'concat (nreverse strings)))) ;; Bracket a number so it looks a bit like a dice roll result (defun org-d20--rolls-bracket (sides roll) -- cgit v1.2.3