Clearer <pipes> word
parent
eb3775c70f
commit
e18bde069e
|
@ -37,17 +37,22 @@ M: callable run-pipeline-element
|
||||||
'[ _ call( -- result ) ] with-streams*
|
'[ _ call( -- result ) ] with-streams*
|
||||||
] with-destructors ;
|
] with-destructors ;
|
||||||
|
|
||||||
: <pipes> ( n -- pipes )
|
GENERIC: <pipes> ( obj -- pipes )
|
||||||
|
|
||||||
|
M: integer <pipes> ( n -- pipes )
|
||||||
[
|
[
|
||||||
[ (pipe) |dispose ] replicate
|
[ (pipe) |dispose ] replicate
|
||||||
T{ pipe } [ prefix ] [ suffix ] bi
|
T{ pipe } [ prefix ] [ suffix ] bi
|
||||||
2 <clumps>
|
2 <clumps>
|
||||||
] with-destructors ;
|
] with-destructors ;
|
||||||
|
|
||||||
|
M: sequence <pipes>
|
||||||
|
[ { } ] [ length 1 - <pipes> ] if-empty ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: run-pipeline ( seq -- results )
|
: run-pipeline ( seq -- results )
|
||||||
[ length dup zero? [ drop { } ] [ 1 - <pipes> ] if ] keep
|
[ <pipes> ] keep
|
||||||
[
|
[
|
||||||
[ [ first in>> ] [ second out>> ] bi ] dip
|
[ [ first in>> ] [ second out>> ] bi ] dip
|
||||||
run-pipeline-element
|
run-pipeline-element
|
||||||
|
|
Loading…
Reference in New Issue