Snippets tagged continuations

  • Continuation-Passing Mnemonics

    Continuations provide a means whereby heap space can be traded for stack depth (heap space being generally more plentiful than stack depth). They are especially useful where tail recursion is not possible. Here are a couple of simple continuation examples that can be extended to cover more complex scenarios.

    88 people like this

    Posted: 6 years ago by Neil Carrier

  • Functional Unparsing SQL

    A combinator based DSL for composing type-safe parameterized sql queries. Inspired by Olivier Danvy's "Functional Unparsing" paper.

    9 people like this

    Posted: 5 years ago by Nick Palladinos

  • Coroutine

    An implementation of Coroutine by using a continuation monad. It's using a monad library [1]. [1] https://github.com/fsharp/fsharpx

    6 people like this

    Posted: 5 years ago by einblicker

  • Semi-Coroutine

    This snippet implements a semi-coroutine by continuations.

    4 people like this

    Posted: 5 years ago by einblicker

  • sum the nodes in a (not-binary) tree using continuations

    you can easily find how to use continuations to iterate over a binary tree but what if the count of children for each node is not known at design time? It's not so obvious how to do this in order to get a tail-recursive method. This short snippet shows how to do this to sum the values of every leaf. The second part demonstrates a general approach for other operations than addition.

    25 people like this

    Posted: 6 years ago by Carsten K├Ânig

  • IterateeCPS

    An iteratee that uses continuation-passing style as an optimization. There is no more discriminated union, and the signature should feel familiar to those using Async.StartWithContinuations.

    5 people like this

    Posted: 5 years ago by Ryan Riley

  • Delimited Continuation Monad

    Oleg's delimited continuation monad [1] and creating an external iterator from an internal iterator using it. [1] http://okmij.org/ftp/continuations/implementations.html#genuine-shift

    6 people like this

    Posted: 5 years ago by einblicker

  • Delimited continuations

    Delimited continuations encoded as a parameterized continuation monad.

    1 people like this

    Posted: 3 years ago by Nick Palladinos