Snippets tagged sequence expressions

  • Random walk

    Create sequence of floating point values generated by random walk process. Functional solution using sequence expressions and yield! construct in a tail-call position.

    39 people like this

    Posted: 13 years ago by Tomas Petricek

  • Flappy bird with sequence expressions

    This is a somewhat sensible solution to the flappy bird dojo by Phil Trelford. It uses sequence expressions eliminate some mutation of the flappy bird. To play this sample on Windows simply copy the code from the raw view and execute in F# interactive, for cross platform implementations check out: http://trelford.com/prognet15.zip

    6 people like this

    Posted: 8 years ago by Tomas Petricek

  • All subsets of a set

    A function implemented using sequence expressions that returns all subsets of a specified set. The function is not optimized, but it is very easy to understand.

    11 people like this

    Posted: 12 years ago by Tomas Petricek

  • Continue sequence after applying Seq.takeWhile, skip, take, etc

    Sometimes you need to take more elements from a sequence, e.g. look at https://stackoverflow.com/questions/12562327/how-to-do-seq-takewhile-one-item-in-f This solution allows fetching elements from the same sequence after applying takeWhile, skip, take and other sequence functions. However, need to remember to call function with right parameter: use 'true' to include current element into result sequence (after takeWhile for example)

    2 people like this

    Posted: 3 years ago by Ruslan Enikeev