Questions tagged [sequence]

A sequence is an ordered list of objects (or events). Like a set, it contains members (also called elements or terms), and the number of terms (possibly infinite) is called the length of the sequence. Unlike a set, order matters, and exactly the same elements can appear multiple times at different positions in the sequence. In a relational database, a sequence is an object that is used to generate unique numbers for a primary key.

A sequence is an ordered list of objects (or events). Like a set, it contains members (also called elements or terms), and the number of terms (possibly infinite) is called the length of the sequence. Unlike a set, order matters, and exactly the same elements can appear multiple times at different positions in the sequence.

Sometimes, sequence is used as a generic name for both list, array and set for convenience.

In a , a sequence is an object that is used to generate unique numbers for a .

5959 questions
23
votes
7 answers

Generate a sequence of Fibonacci number in Scala

def fibSeq(n: Int): List[Int] = { var ret = scala.collection.mutable.ListBuffer[Int](1, 2) while (ret(ret.length - 1) < n) { val temp = ret(ret.length - 1) + ret(ret.length - 2) if (temp >= n) { return ret.toList …
nobody
  • 2,709
  • 6
  • 35
  • 37
23
votes
4 answers

Generate series 1, 2,1, 3,2,1, 4,3,2,1, 5,4,3,2,1

I am trying to generate a vector containing decreasing sequences of increasing length, such as 1, 2,1, 3,2,1, 4,3,2,1, 5,4,3,2,1, i.e. c(1, 2:1, 3:1, 4:1, 5:1) I tried to use a loop for this, but I don't know how to stack or concatenate the…
FFB
  • 255
  • 2
  • 7
23
votes
8 answers

How to make a continuous alphabetic list python (from a-z then from aa, ab, ac etc)

I would like to make a alphabetical list for an application similar to an excel worksheet. A user would input number of cells and I would like to generate list. For example a user needs 54 cells. Then I would…
Seb
  • 3,655
  • 3
  • 17
  • 17
23
votes
3 answers

Sequence as default value for a column

I have already created a sequence: create sequence mainseq as bigint start with 1 increment by 1 How do I use this sequence as the default value of a column? create table mytable( id bigint not null default mainseq -- how? code …
Endy Tjahjono
  • 24,120
  • 23
  • 83
  • 123
22
votes
3 answers

what is the maximum value of MAXVALUE in sequence in oracle?

Could you tell me what is the maximum/minimum value of MAXVALUE in a sequence & what is the minimum/maximum value of MINVALUE in sequence?
user1252398
  • 1,069
  • 7
  • 22
  • 29
22
votes
3 answers

Deleting every n-th row in a dataframe

How can I delete every n-th row from a dataframe in R?
Yktula
  • 14,179
  • 14
  • 48
  • 71
22
votes
5 answers

Repeating a repeated sequence

We want to get an array that looks like this: 1,1,1,2,2,2,3,3,3,4,4,4,1,1,1,2,2,2,3,3,3,4,4,4,1,1,1,2,2,2,3,3,3,4,4,4 What is the easiest way to do it?
Fabian Stolz
  • 1,935
  • 7
  • 27
  • 30
21
votes
4 answers

Create a sequence of sequences of numbers

I would like to make the following sequence in R, by using rep or any other function. c(1, 2, 3, 4, 5, 2, 3, 4, 5, 3, 4, 5, 4, 5, 5) Basically, c(1:5, 2:5, 3:5, 4:5, 5:5).
Rene
  • 363
  • 2
  • 7
21
votes
5 answers

Create grouping variable for consecutive sequences and split vector

I have a vector, such as c(1, 3, 4, 5, 9, 10, 17, 29, 30) and I would like to group together the 'neighboring' elements that form a regular, consecutive sequence, i.e. an increase by 1, in a ragged vector resulting in: L1: 1 L2: 3,4,5 L3: 9,10 L4:…
letsrock
  • 211
  • 2
  • 3
21
votes
2 answers

how create a sequence of strings with different numbers in R

I just cant figure it out how to create a vector in which the strings are constant but the numbers are not. For example: c("raster[1]","raster[2]","raster[3]") I'd like to use something like seq(raster[1],raster[99], by=1), but this does not…
Agus camacho
  • 868
  • 2
  • 9
  • 24
21
votes
1 answer

What is sequence file in hadoop?

I am new to Map-reduce and I want to understand what is sequence file data input? I studied in the Hadoop book but it was hard for me to understand.
Soghra Gargari
  • 401
  • 1
  • 4
  • 9
21
votes
5 answers

Is there something like "if not exist create sequence ..." in Oracle SQL?

For my application that uses an Oracle 8 DB, I am providing an SQL script to setup stuff like triggers, sequences etc., which can be copied and pasted into SQL*Plus. I would like the script to not stop with an error if a sequence that I am trying to…
Timo
  • 1,088
  • 1
  • 10
  • 19
21
votes
3 answers

Is it possible to match with decomposed sequences in F#?

I seem to remember an older version of F# allowing structural decomposition when matching sequences just like lists. Is there a way to use the list syntax while keeping the sequence lazy? I'm hoping to avoid a lot of calls to Seq.head and Seq.skip…
Ball
  • 2,591
  • 3
  • 19
  • 26
21
votes
5 answers

How to make a vector using a for loop

I'm very new to R (and programming in general) and I've been stuck on this (probably very easy) question for a few days... How would one make the vector 3 6 12 24 48 96 192 384 768 with a for loop? All I've managed to come up with so far is…
user1990538
  • 227
  • 1
  • 2
  • 3
21
votes
3 answers

How do I check if a sequence exists or not in Oracle 11g?

I am using Oracle 11g. I want to be able to determine whether a particular sequence exists or not. I have tried the code below but it is not working. (It is returning 0 as count value when there should be more): SELECT COUNT(*) FROM…
user968441
  • 1,471
  • 9
  • 22
  • 48