4 people like it.

Fibonacci sequence with scan

Fibonacci sequence with scan

1: 
2: 
#nowarn "40"
let rec fibonacci = seq { yield 1; yield! Seq.scan (+) 2 fibonacci }
val fibonacci : seq<int>

Full name: Script.fibonacci
Multiple items
val seq : sequence:seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Core.Operators.seq

--------------------
type seq<'T> = System.Collections.Generic.IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>
module Seq

from Microsoft.FSharp.Collections
val scan : folder:('State -> 'T -> 'State) -> state:'State -> source:seq<'T> -> seq<'State>

Full name: Microsoft.FSharp.Collections.Seq.scan
Raw view New version

More information

Link:http://fssnip.net/tc
Posted:1 years ago
Author:Andriy Tolstoy
Tags: fibonacci , scan , seq