Snippets created by Vasily Kirichenko

  • Even more Fast hex dump

    A simple function that nicely formats arrays of bytes. Useful in FSI or logging. byte array -> string seq Inspired by http://fssnip.net/hq, but optimized to become O(n).

    3 people like this

    Posted: 4 years ago by Vasily Kirichenko

  • "Fastest wins" parallel download with Hopac

    One of the main features of Hopac - selective synchronization using "alternatives". In this snippet we download three web pages in parallel and the one that finishes first "wins" (or the timeout alternative becomes available for picking). What's nice in this solution is that the other two downloading jobs are cancelled immediately when the winner/timeout is available (i.e. an implicitly provided to the Asyncs CancellationTokens are cancelled). Alts is highly composable and, for example, the whole Alt.choose [ ... ] thing could be nested in another Alt.choose or combined with <|> or <&> operators with another Alt and so on.

    3 people like this

    Posted: 2 years ago by Vasily Kirichenko

  • Joinads' "One place buffer" sample ported to Hopac

    https://github.com/tpetricek/FSharp.Joinads/blob/master/src/Joins/Samples.fs#L60 ported to Hopac.

    1 people like this

    Posted: 2 years ago by Vasily Kirichenko