Skip to content

Instantly share code, notes, and snippets.

@Slesa
Created November 15, 2014 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Slesa/b0d51727d056f09766e3 to your computer and use it in GitHub Desktop.
Save Slesa/b0d51727d056f09766e3 to your computer and use it in GitHub Desktop.
Secret of sequences
// seq<int64> -> #seq<int64>
let req findAllPrimes values =
let sequence = seq {
for value in values do
if isPrime value then
yield value
else
let divisors = findDivisors value
yield! findAllPrimes divisors }
sequence
// 'findAllPrimes' not defined
let getPrimes values =
let result = findAllPrimes values
result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment