From 249cb3338eff23c98b510cded42959332a8b7b5a Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 1 Mar 2024 22:22:01 +0200 Subject: Add gnosis-algorithm-replace-at-index --- gnosis-algorithm.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gnosis-algorithm.el b/gnosis-algorithm.el index ed46149..da9a070 100644 --- a/gnosis-algorithm.el +++ b/gnosis-algorithm.el @@ -74,6 +74,12 @@ NOTE: Do not change this value above 1" :group 'gnosis :type 'integer) +(defun gnosis-algorithm-replace-at-index (index new-item list) + "Replace item at INDEX with NEW-ITEM in LIST." + (cl-loop for item in list + for i from 0 + collect (if (= i index) new-item item))) + (defun gnosis-algorithm-date (&optional offset) "Return the current date in a list (year month day). -- cgit v1.2.3