Here is an improved version twice shorter, than original
72 people like thisPosted: 7 years ago by Nick Canzoneri
A lazy enumerable/stream of bytes.
9 people like thisPosted: 7 years ago by Ryan Riley
Function to generate circular infinite sequence from a list
18 people like thisPosted: 7 years ago by Ankur Dhama
Normalized Random sequence generator conforming to the user supplied mean and sigma utilizing a "seed factory" instead of the default time of day. The Gaussian sequence is based on the central limit theory, averages together the flat distribution from the random generator built into .NET. Two examples of using normalRand are given to create infinite sequences of white and brown(ian) noise.
45 people like thisPosted: 7 years ago by Tony Lee
Tree implementation using sequences.
2 people like thisPosted: 7 years ago by Ankur Dhama
Select n elements in group from seq
2 people like thisPosted: 7 years ago by Ankur Dhama
Repeatedly call a function until it returns a positive result. Implemented using sequences.
3 people like thisPosted: 7 years ago by Johann Deneux
An initial attempt at creating a ByteString type based on the Haskell version.
3 people like thisPosted: 7 years ago by Ryan Riley
The function has the same type as Seq.reduce. Instead of reducing elements from the left to the right, it splits the input into two halves, reduces each half separately and then aggregates the results using the given function. This means that the values are aggregated into a ballanced tree, which can save stack space.
2 people like thisPosted: 7 years ago by Tomas Petricek
The snippet implements 'List.partitionWhile' which behaves as a combination of 'Seq.takeWhile' and 'Seq.skipWhile': It splits the list into a part containing elements from the beginning of a list that match a given predicate and remaining elements.
5 people like thisPosted: 5 years ago by Tomas Petricek
Generates the Prime Number Sequence.
1 people like thisPosted: 5 years ago by AdamSpeight2008
Sequence expression which deals with cartesian product of sequences with for ... do expression. It replaces nested for .. do expression to single one.
0 people like thisPosted: 4 years ago by nagat01
A variation of another snippet "Seq.groupWhen". This one groups adjacent elements based on a predicate that accepts two arguments - the previous and current elements
5 people like thisPosted: 4 years ago by Faisal Waris
Full source code for my blog entry on this subject - http://chrsb.co/BNqAbM
1 people like thisPosted: 4 years ago by Chris Ballard
A generic function that randomly permutes the elements of a sequence.
0 people like thisPosted: 10 months ago by Taha Hachana
An asynchronous sequence is similar to the seq
Posted: 7 years ago by Tomas Petricek
Cached fib sequence
14 people like thisPosted: 7 years ago by Dmitri Pavlenkov
A function that takes every Nth element of a sequence where N is passed as an argument. The snippet shows a naive function and a function using IEnumerator directly to provide an efficient implementation.
30 people like thisPosted: 7 years ago by Tomas Petricek
An abstraction of the following use case: Given a sequence of dates and max temperatures for each date, extract out the initial dates on which the temp is greater than a given threshold for n consecutive days. (Originally posted as an answer to this StackOverflow question: http://stackoverflow.com/questions/5267055 )
12 people like thisPosted: 7 years ago by ildjarn
Since F# is my new scripting language, I needed something like Perl's exec but with sequences for Std In and Out.
7 people like thisPosted: 7 years ago by Tony Lee
Functional quicksort inspired by the Haskell Quick Sort at http://www.haskell.org/haskellwiki/Introduction. Since F# lists aren't lazy, uses sequences instead of lists to be haskell like. Roughly O(n) if you Seq.take 1, full on QS if you enumerate the whole thing.
2 people like thisPosted: 7 years ago by Tony Lee
Seq group continuous matching elements [1;1;1;2;2;2] will become [ [1;1;1] ; [2;2;2] ]
2 people like thisPosted: 7 years ago by Ankur Dhama
Splices a sequence into another sequence at a specified index n. Can replace the existing element at n or keep it.
3 people like thisPosted: 7 years ago by Henrik Ravn
A function that nests items of a sequence that do not match a specified predicate under the last item that matches the predicate. The input is a sequence of values and the result is a sequence of pairs where the second element is a list of nested items.
3 people like thisPosted: 6 years ago by Tomas Petricek
Adds "enumerable extraction" support to query expressions
7 people like thisPosted: 5 years ago by kvb
The dominator of array A is the value that occurs in more than half of the elements of A. It is a zero-indexed based array consisting of N integers (A [] with N length). To find the index array of the dominator from a A [], we can use a helpful function from Seq module call 'Seq.groupBy' to mitigate the implementation of a solution.
4 people like thisPosted: 5 years ago by Joel Huang
Function to combine the values of a list of sequences into a sequence of lists where each list contains the nth element of the different sequences. It works like zip but for an arbitrary number of sequences and it returns lists instead of tuples. As with zip when one sequence is exhausted any remaining elements in the other sequences are ignored.
4 people like thisPosted: 4 years ago by Samuel Bosch
Whilst working on a google API wrapper, I came across the need to separate a sequence into sub-sequences based on a separator condition. This also led to a requirement for versions of takeWhile and skipWhile which also include the element which first breaks the condition predicate.
3 people like thisPosted: 4 years ago by Chris Ballard
Create a circular (repeating) sequence from an input sequence, optionally limiting the total number of elements.
0 people like thisPosted: 2 years ago by Hugh Gleaves
Eliminate repetitions in a sequence, preserving the first element in each run of repeats.
2 people like thisPosted: 2 months ago by Kit Eason