diff --git a/basis/combinators/smart/smart-tests.factor b/basis/combinators/smart/smart-tests.factor index 399b4dc36f..bd224919f9 100644 --- a/basis/combinators/smart/smart-tests.factor +++ b/basis/combinators/smart/smart-tests.factor @@ -47,3 +47,9 @@ IN: combinators.smart.tests [ { { 1 2 } { 3 4 } } ] [ nested-smart-combo-test ] unit-test [ 14 ] [ [ 1 2 3 ] [ sq ] [ + ] map-reduce-outputs ] unit-test + +{ 2 3 } [ [ + ] preserving ] must-infer-as + +{ 2 0 } [ [ + ] nullary ] must-infer-as + +{ 2 2 } [ [ [ + ] nullary ] preserving ] must-infer-as diff --git a/basis/combinators/smart/smart.factor b/basis/combinators/smart/smart.factor index a00967742f..91987e0dfa 100644 --- a/basis/combinators/smart/smart.factor +++ b/basis/combinators/smart/smart.factor @@ -46,5 +46,8 @@ MACRO: append-outputs ( quot -- seq ) MACRO: preserving ( quot -- ) [ infer in>> length ] keep '[ _ ndup @ ] ; +MACRO: nullary ( quot -- quot' ) + dup infer out>> length '[ @ _ ndrop ] ; + MACRO: smart-if ( pred true false -- ) '[ _ preserving _ _ if ] ; inline