Implement a function to remove specific indices from a list
This commit is contained in:
@@ -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))
|
(fn parse-integer* (inp) (-> (string) (or integer list))
|
||||||
"Given string INP, attempt to parse an integer. Return NIL otherwise."
|
"Given string INP, attempt to parse an integer. Return NIL otherwise."
|
||||||
(parse-integer inp :junk-allowed t))
|
(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))
|
||||||
|
|||||||
@@ -30,7 +30,8 @@
|
|||||||
(:export
|
(:export
|
||||||
:parse-integer*
|
:parse-integer*
|
||||||
:range :take :split
|
:range :take :split
|
||||||
:rev-map))
|
:rev-map
|
||||||
|
:remove-at-indices))
|
||||||
|
|
||||||
(defpackage cantedraw.model
|
(defpackage cantedraw.model
|
||||||
(:use :cl :cantedraw.lib.macros :cantedraw.lib.functions)
|
(:use :cl :cantedraw.lib.macros :cantedraw.lib.functions)
|
||||||
|
|||||||
Reference in New Issue
Block a user