combinators.smart: Add cleave>sequence.
parent
d196f8f141
commit
cda2e4d7da
basis/combinators/smart
|
@ -90,3 +90,8 @@ IN: combinators.smart.tests
|
|||
{ 1 1 1 } [ 1 3 [ ] smart-with times ] unit-test
|
||||
{ "BCD" } [ 1 "ABC" [ + ] smart-with map ] unit-test
|
||||
{ H{ { 1 2 } } } [ 1 H{ { 1 2 } { 3 4 } } [ drop = ] smart-with assoc-filter ] unit-test
|
||||
|
||||
: test-cleave>sequence ( obj -- seq ) { [ 1 + ] [ sq ] [ 1 - ] } V{ } cleave>sequence ;
|
||||
\ test-cleave>sequence def>> must-infer
|
||||
|
||||
{ V{ 34 1089 32 } } [ 33 test-cleave>sequence ] unit-test
|
||||
|
|
|
@ -70,6 +70,9 @@ M: object infer-known* drop f ;
|
|||
: cleave>array ( x seq -- array )
|
||||
'[ _ cleave ] output>array ; inline
|
||||
|
||||
: cleave>sequence ( x seq exemplar -- array )
|
||||
[ '[ _ cleave ] ] dip output>sequence ; inline
|
||||
|
||||
: input<sequence ( seq quot -- )
|
||||
[ inputs firstn ] [ call ] bi ; inline
|
||||
|
||||
|
|
Loading…
Reference in New Issue