sequences

Sequences only programming language

I once read about a programming laguage which only first-order values were sequences. An integer value, for instance, was seen as a sequence of integers of one element. I totally forgot the name of that language, and the terms i use to search google are too generic, i can't find it. Anyone remembers it? :) ...

Python: is not sequence

In python is there an easy way to tell if something is not a sequence? I tried to just do: if x is not sequence but python did not like that ...

Sequence reduction in R

Assume you have a vector like so: v <- c(1,1,1,2,2,2,2,1,1,3,3,3,3) How can it be best reduced to a data.frame like this? v.df <- data.frame(value=c(1,2,1,3),repetitions=c(3,4,2,4)) In a procedural language I might just iterate through a loop and build the data.frame as I go, but with a large dataset in R such an approach is ineffi...

Pseudo-Random Binary Sequence Prediction (Newbie)

Hi, i know nothing about programming or C or windowing... nothing too deep about computers... but i'm very interested in: given a pseudo-random binary sequence (e.g.: 00101010010101) of finite values, predict how will the sequence continue. Can someone please tell me the easiest way to do it? Or in case it's too difficult for someone who...

Are there sequence-operator implementations in .NET 4.0?

With that I mean similar to the Linq join, group, distinct, etc. only working on sequences of values, not collections. The difference between a sequence and a collection is that a sequence might be infinite in length, whereas a collection is finite. Let me give you an example: var c1 = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; var c2 =...

Sequence Programming Problem

Hi, Problem Statement You have an infinite sequence A[] with the following properties: * A[0], A[1], ..., A[N-1] are given; * A[i]=(A[i-1]+A[i-2]+...+A[i-N])%10 for all i>=N; Sequence B[] with length M is a substring of A[] if there is such index P that B[0]=A[P], B[1]=A[P+1], ..., B[M-1]=A[P+M-1]. Your task is to find the smal...

How can I determine the actual database row insertion order?

I have a multithreaded process which inserts several records into a single table. The inserts are performed in a stored procedure, with the sequence being generated INTO a variable, and that variable is later used inside of an INSERT. Given that I'm not doing mysequence.nextval inside the INSERT itself, it makes me think that it is pos...

OracleCommandBuilder.GetInsertCommand() and Oracle and setting sequence.nextVal result to variable

Hello, I want to use OracleCommandBuilder to automatically generate commands for my DataAdapter. But how can I use the oracles sequences to insert values in those automatically generated commands? Yes, I know about such construction: "INSERT INTO myTable (id, my_name, my_date) ...

Seq seq type as a member parameter in F#

Hi, why does not this code work? type Test() = static member func (a: seq<'a seq>) = 5. let a = [[4.]] Test.func(a) It gives following error: The type 'float list list' is not compatible with the type 'seq<seq<'a>>' ...

generating all the covering substrings of a string

How do you the following: given a string, generate all the possible ways to parse that string into substrings (time is important, space dont' care). For example, given the string ABCD, I need to generate: ABCD A BCD A BC D A B CD AB CD AB C D ABC D A B C D Probably a recursive solution, but I can't quite get it to work. ...

Hibernate and Postgresql - generator class in hibernate mapping file

Hi, The ids in my postgresql database are auto-incremental (there are sequences defined in a database). When creating a hibernate mapping files I set the class generator to increment: <class name="model.Names" schema="public" table="names"> <id name="id" type="int"> <column name="id"/> <generator class="increment"/> ...

Get seq number used by insert statement called from C# (oracle)

I need to insert a record into a table and set the value of a column (e.g. orderid) to a unique #. And return that number used. I thought the process would be to do use a sequence and an insert statement with nextval: insert into ordersTable(orderid) values(ordernums.nextval); But how to I get the number that was used? My thought i...

In Oracle, is using Sequences for surrogate primary keys considered standard

Caveats: Let me first clarify that this is not a question about whether to use surrogates primary keys or not. Also, this is NOT a related to identities (SQL Server) / Sequences (Oracle) and their pros / cons. I did get a fair bit of idea about that thanks to this, this and this Question: I come from a SQL Server background and have...

C#: Detecting sequence of at least 3 sequential numbers from a given list

I have a list of numbers e.g. 21,4,7,9,12,22,17,8,2,20,23 I want to be able to pick out sequences of sequential numbers (minimum 3 items in length), so from the example above it would be 7,8,9 and 20,21,22,23. I have played around with a few ugly sprawling functions but I am wondering if there is a neat LINQ-ish way to do it. Any sug...

How to use a trigger that gets the next value in a sequence

I'm just learning Oracle and I understand the concept of triggers and sequences. What I can't seem to find is how they are used together in an auto-increment fashion similar to a SqlServer Identity setting. In a really simple example, I have a table called Employees that has three fields (all required): EmployeeID (PK), FirstName, LastNa...

Implementing sequence in Java using Hibernate

Hi, I am using Java and Hibernate as ORM tool. Is there any way i can implement sequence in Java using Hibernate? Currently I am using Oracle sequences to achieve this, but that is a very costly way as interaction with database increases. Please help. ...

F# Manage multiple lazy sequences from a single method?

I am trying to figure out how to manage multiple lazy sequences from a single function in F#. For example, in the code below, I am trying to get two sequences - one that returns all files in the directories, and one that returns a sequence of tuples of any directories that could not be accessed (for example due to permissions) with th...