From 6a3626d961d6d1e500125af7e1c912ac4133ecd7 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 14 Feb 2025 23:22:18 +0000 Subject: Implement a function to remove specific indices from a list --- lib/functions.lisp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/functions.lisp') diff --git a/lib/functions.lisp b/lib/functions.lisp index 99796c9..2a7f4ab 100644 --- a/lib/functions.lisp +++ b/lib/functions.lisp @@ -54,3 +54,9 @@ where key x in A has associations {y in LST : INDICATOR(y) = x}." (fn parse-integer* (inp) (-> (string) (or integer list)) "Given string INP, attempt to parse an integer. Return NIL otherwise." (parse-integer inp :junk-allowed t)) + +(fn remove-at-indices (indices lst) (-> (list list) list) + (loop :for i :from 0 :to (1- (length lst)) + :for item :in lst + :if (not (member i indices)) + :collect item)) -- cgit v1.2.3-13-gbd6f