GNU bug report logs -
#68863
Add support for using setf with seq-subseq
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hello,
This patch adds support for using `seq-subseq` with `setf`, as in
;; => [0 1 2 10 11]
(let ((seq (vector 0 1 2 3 4)))
(setf (seq-subseq seq -2) (list 10 11 12 13 14))
seq)
The patch adds a generic version which uses the existing `setf` support
of `seq-elt` and a specialized version for modifying lists. Both
versions use `seq-do` to map a function over the values that should
replace the values in the modified sequence.
To avoid modifying more values than specified, that modifying function
uses a `when` condition. I'm not sure of a good way to stop `seq-do`
early when we know that it can stop calling the modifying function.
Normally, I would use `cl-block` and `cl-return`. Is it OK to use those
features in `seq.el`? If not, is it worth adding something like a
`seq-map-while` or a `seq-do-while`?
Thank you.
[0001-Add-setf-support-for-seq-subseq.patch (text/x-patch, attachment)]
This bug report was last modified 107 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.