Questions tagged [seq.unfold]

3 questions
20
votes
2 answers

Why is using a sequence so much slower than using a list in this example

Background: I have a sequence of contiguous, time-stamped data. The data-sequence has holes in it, some large, others just a single missing value. Whenever the hole is just a single missing value, I want to patch the holes using a dummy-value…
Treefrog
  • 403
  • 4
  • 9
7
votes
3 answers

In F#, How do I use Seq.unfold in the context of a larger pipeline?

I have a CSV file with two columns, text and count. The goal is to transform the file from this: some text once,1 some text twice,2 some text thrice,3 To this: some text once,1 some text twice,1 some text twice,1 some text thrice,1 some text…
akucheck
  • 185
  • 1
  • 1
  • 9
5
votes
4 answers

Seq.unfold explanation in F#

I am trying to create a sequence lazily by using F#. The sequence is defined as follows: The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, …
masfenix
  • 7,736
  • 11
  • 45
  • 60