Questions tagged [sequences]

8 questions
5
votes
1 answer

Rings and sequences

I find it surprising that rings (from make-ring) are sequences (satisfy sequencep), but cannot be operated on by standard sequence functions (length, elt, etc.). What, then, does being a "sequence" entail? The Elisp manual says that: The “sequence”…
Tianxiang Xiong
  • 3,848
  • 16
  • 27
4
votes
2 answers

mapcar but return non-nil element only

Is there a function that applies a transformation to a sequence and returns only the non-nil values? Right now I am using the following (as an example): (seq-filter #'identity (mapcar (lambda (x) (when (< x 3) (+ x…
Tohiko
  • 1,589
  • 1
  • 10
  • 22
3
votes
3 answers

How to check if a vector includes a value

When I want to know whether a list includes a value, I can use member function. (member "a" '("a" "ā" "á" "ǎ" "à")) Is there similar way to check if a vector includes a value? (member "a" ["a" "ā" "á" "ǎ" "à"]) ;=> nil
ironsand
  • 403
  • 3
  • 14
2
votes
1 answer

Why do stream-cons and cons behave differently?

I am trying to create a lazy sequence of the lines in the current buffer using the stream.el library. These two recursive functions both read the lines of the current buffer from point to the end of the buffer. The first function collects the lines…
2
votes
0 answers

Do we have anaphoric macros of seq.el?

In dash.el, there are anaphoric macros (it saves to write "lambda": (--map (* it 2) '(1 2)) instead of (-map (lambda (it) (* it 2)) '(1 2))) seq.el is more generic, it works on strings and vectors too, but it doesn't include anaphoric macros (and…
Ehvince
  • 1,091
  • 10
  • 14
1
vote
2 answers

Filter list by regexps

How can I get all elements of a list which don't match multiple patterns? The patterns are given as a list. For instance, I want all files without '("no" "nix") in them. (setq se-have '("~/site/src/good-org.org" …
Lorem Ipsum
  • 4,327
  • 2
  • 14
  • 35
0
votes
2 answers

Testing sequence for certain number of occurences of specific element

How can I test whether an array mfselc is composed of zeroes or all zeroes except for a single value being 1. Thus mfselc [0 0 1 0 0 0] is acceptable Also mfselc [0 0 0 0 0 0] is acceptable But mfselc [0 1 1 0 0 0] is not acceptable
Dilna
  • 1,173
  • 3
  • 10
0
votes
1 answer

Effective concatenation

How can I concatenate two sequences of lists (either lists of lists or vectors of lists) in constant time (independent of their size)?
JAre
  • 175
  • 5