: count-with-yields ( Int -- Int )
    0 swap
    [ dup 0 i.> ]
    [
        chan.yield
        swap 1 i.+ swap
        1 i.-
    ]
    while
    drop
;

: test-yield ( -- )
    5 count-with-yields
    5 test.assert-eq
;
