Jump to content

position-insert-seq


Recommended Posts

kind of ... "position-insert" with OVERWRITE

 

(defun position-insert-seq (&key alist insert item)
  (let ((pos (car (position-item item alist))))
    (position-replace (gen-integer pos (+ pos (1- (length insert)))) insert alist)))


(setf alist '(0 0 0 0 0 0 1 0 2 0 0 0 3 5 7))
(setf insert '(a b c d))

(position-insert-seq :alist '(0 0 0 0 0 0 1 0 2 0 0 0 3 5 7)
                 :insert '(a b c d)
                 :item 2)

=> (0 0 0 0 0 0 1 0 a b c d 3 5 7)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy