summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-03-01 22:22:01 +0200
committerThanos Apollo <[email protected]>2024-03-01 22:22:01 +0200
commit249cb3338eff23c98b510cded42959332a8b7b5a (patch)
tree363f770f2c5a8041fdf7b2578cf63675a1a44a9d
parent652ce6e5c05deaa7626e5bd07efbc7ce282fa1fe (diff)
Add gnosis-algorithm-replace-at-index
-rw-r--r--gnosis-algorithm.el6
1 files changed, 6 insertions, 0 deletions
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).