Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
58c09819
Commit
58c09819
authored
Feb 06, 2015
by
NicolasPetton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better docstring for seq.el functions
* lisp/emacs-lisp/seq.el: Better docstring for seq.el functions
parent
c4a0eff0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
lisp/ChangeLog
lisp/ChangeLog
+2
-0
lisp/emacs-lisp/seq.el
lisp/emacs-lisp/seq.el
+11
-7
No files found.
lisp/ChangeLog
View file @
58c09819
2015-02-06 Nicolas Petton <nicolas@petton.fr>
* emacs-lisp/seq.el (seq-mapcat, seq-partition, seq-group-by): New functions.
* emacs-lisp/seq.el (seq-drop-while, seq-take-while, seq-count)
(seq--drop-list, seq--take-list, seq--take-while-list): Better docstring.
2015-02-06 Artur Malabarba <bruce.connor.am@gmail.com>
...
...
lisp/emacs-lisp/seq.el
View file @
58c09819
...
...
@@ -92,14 +92,14 @@ returned."
(
seq-subseq
seq
0
(
min
(
max
n
0
)
(
seq-length
seq
)))))
(
defun
seq-drop-while
(
pred
seq
)
"Return a sequence
,
from the first element for which (PRED element) is nil
, of
SEQ.
"Return a sequence from the first element for which (PRED element) is nil
in
SEQ.
The result is a sequence of the same type as SEQ."
(
if
(
listp
seq
)
(
seq--drop-while-list
pred
seq
)
(
seq-drop
seq
(
seq--count-successive
pred
seq
))))
(
defun
seq-take-while
(
pred
seq
)
"Return
a sequence of
the successive elements for which (PRED element) is non-nil in SEQ.
"Return the successive elements for which (PRED element) is non-nil in SEQ.
The result is a sequence of the same type as SEQ."
(
if
(
listp
seq
)
(
seq--take-while-list
pred
seq
)
...
...
@@ -152,7 +152,7 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not called."
t
))
(
defun
seq-count
(
pred
seq
)
"Return the number of elements for which (PRED element)
return
s non-nil in
seq
."
"Return the number of elements for which (PRED element)
i
s non-nil in
SEQ
."
(
let
((
count
0
))
(
seq-doseq
(
elt
seq
)
(
when
(
funcall
pred
elt
)
...
...
@@ -258,14 +258,16 @@ keys. Keys are compared using `equal'."
nil
)))
(
defun
seq--drop-list
(
list
n
)
"Optimized version of `seq-drop' for lists."
"Return a list from LIST without its first N elements.
This is an optimization for lists in `seq-drop'."
(
while
(
and
list
(
>
n
0
))
(
setq
list
(
cdr
list
)
n
(
1-
n
)))
list
)
(
defun
seq--take-list
(
list
n
)
"Optimized version of `seq-take' for lists."
"Return a list from LIST made of its first N elements.
This is an optimization for lists in `seq-take'."
(
let
((
result
'
()))
(
while
(
and
list
(
>
n
0
))
(
setq
n
(
1-
n
))
...
...
@@ -273,13 +275,15 @@ keys. Keys are compared using `equal'."
(
nreverse
result
)))
(
defun
seq--drop-while-list
(
pred
list
)
"Optimized version of `seq-drop-while' for lists."
"Return a list from the first element for which (PRED element) is nil in LIST.
This is an optimization for lists in `seq-drop-while'."
(
while
(
and
list
(
funcall
pred
(
car
list
)))
(
setq
list
(
cdr
list
)))
list
)
(
defun
seq--take-while-list
(
pred
list
)
"Optimized version of `seq-take-while' for lists."
"Return the successive elements for which (PRED element) is non-nil in LIST.
This is an optimization for lists in `seq-take-while'."
(
let
((
result
'
()))
(
while
(
and
list
(
funcall
pred
(
car
list
)))
(
push
(
pop
list
)
result
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment