From 100024613554418977854c43a070a000409e3333 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sat, 7 May 2022 18:04:31 -0400 Subject: [PATCH] REF remove silly while loop --- local/lib/org-x/org-x-dag.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index e3bc8e5..8c23334 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -2490,12 +2490,15 @@ encountered will be returned." ;; (DST, leap year, different days in each month, etc). Think of this like ;; a path function from p-chem; shifting 3 months once might be different ;; than shifting by 1 month three times. - (let ((next datetime) - (pastp t)) - (while pastp - (setq next (org-x-dag-datetime-shift next shift shifttype) - pastp (org-x-dag-datetime< next sel-datetime))) - next)) + (->> (list t datetime) + (--unfold + (-let (((pastp datetime) it)) + (print pastp) + (when pastp + (let* ((next (org-x-dag-datetime-shift datetime shift shifttype)) + (pastp (org-x-dag-datetime< next sel-datetime))) + `(,next . (,pastp ,next)))))) + (-last-item))) ('restart ;; Next time is one repeater interval after now ;;