with-datastacks ( seq quot -- seq )


Vocabulary
continuations.extras

Inputs
seqan array
quota quotation with stack effect ( ... -- ... )


Outputs
seqan array


Word description
Executes a quotation with inputs, preserving inputs and outputsTakes a quotation and a seq containing inputs for the quotationReturns a seq containing the inputs as well as any produced outputUseful for checking the behaviour of words under different inputs

Examples
USING: continuations.extras math prettyprint ; { { 1 2 } { 3 4 } { 2 3 } { 1 4 } } [ + ] with-datastacks .
{ { { 1 2 } { 3 } } { { 3 4 } { 7 } } { { 2 3 } { 5 } } { { 1 4 } { 5 } } }

! generating inputs using math.combinatorics USING: continuations.extras kernel math.combinatorics prettyprint ; { t f } 2 all-selections [ xor ] with-datastacks .
{ { { t t } { f } } { { t f } { t } } { { f t } { t } } { { f f } { f } } }

! generating inputs using math.combinatorics and ranges USING: continuations.extras math math.combinatorics prettyprint ranges ; 4 [1..b] 2 all-combinations [ + ] with-datastacks .
{ { { 1 2 } { 3 } } { { 1 3 } { 4 } } { { 1 4 } { 5 } } { { 2 3 } { 5 } } { { 2 4 } { 6 } } { { 3 4 } { 7 } } }


Definition