async 0.3.2

async 0.3.1

async 0.3

Version 0.3 of async contains a number of new features, usability and performance improvements.

    > g <- gen(for (i in 1:10) {yield(i); if (x %% 2 == 0) yield("even.") else yield("odd!")})
    > g
    gen(for (i in 1:10) {
    if (x%%2 == 0) 
    else yield("odd!")
    <environment: R_GlobalEnv>
    <Generator [yielded at `.for2.R__eval_`]>
    > nextElem(g)
    [1] 1
    > getNode(g)
    [1] ".for3.{1;__;"
    > nextElem(g)
    [1] "odd!"
    > getNode.generator(g)
    [1] ".for__again"

To unpack the above, on creation the generator is paused at node ".for2.R__eval_" i.e. the R expression in the second argument of for, which in this case is the expression 1:10. After executing the first yield, the generator shows it is paused at ".for3.{1;__;", that is, at the “semicolon” following the first statement in the braces in the third argument of for; so the next thing the generator will execute is the subsequent if statement. After the next yield, the label ".for__again" means that the generator’s next action will be to return to the beginning of the for loop.

    g <- gen(function(x, y) for (i in x:y) yield(i))
    g <- function(x, y) {force(list(x, y)); gen(for (i in x:y) yield(i))}

(so really it just saves you from remembering to force your arguments.)

async 0.2.2

async 0.2.1


async 0.2


async 0.1