combinators.smart: Add cleave>array.
parent
320efb8bc7
commit
8bfed897a8
|
@ -3,7 +3,8 @@
|
||||||
USING: accessors arrays effects fry generalizations kernel
|
USING: accessors arrays effects fry generalizations kernel
|
||||||
macros math math.order sequences sequences.generalizations
|
macros math math.order sequences sequences.generalizations
|
||||||
stack-checker stack-checker.backend stack-checker.errors
|
stack-checker stack-checker.backend stack-checker.errors
|
||||||
stack-checker.values stack-checker.visitor words memoize ;
|
stack-checker.values stack-checker.visitor words memoize
|
||||||
|
combinators ;
|
||||||
IN: combinators.smart
|
IN: combinators.smart
|
||||||
|
|
||||||
GENERIC: infer-known* ( known -- effect )
|
GENERIC: infer-known* ( known -- effect )
|
||||||
|
@ -66,6 +67,9 @@ M: object infer-known* drop f ;
|
||||||
: output>array ( quot -- array )
|
: output>array ( quot -- array )
|
||||||
{ } output>sequence ; inline
|
{ } output>sequence ; inline
|
||||||
|
|
||||||
|
: cleave>array ( x seq -- array )
|
||||||
|
'[ _ cleave ] output>array ; inline
|
||||||
|
|
||||||
: input<sequence ( seq quot -- )
|
: input<sequence ( seq quot -- )
|
||||||
[ inputs firstn ] [ call ] bi ; inline
|
[ inputs firstn ] [ call ] bi ; inline
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,6 @@ TUPLE: class-partition integers not-integers simples not-simples and or other ;
|
||||||
class-partition boa ;
|
class-partition boa ;
|
||||||
|
|
||||||
: class-partition>sequence ( class-partition -- seq )
|
: class-partition>sequence ( class-partition -- seq )
|
||||||
[
|
|
||||||
{
|
{
|
||||||
[ integers>> ]
|
[ integers>> ]
|
||||||
[ not-integers>> ]
|
[ not-integers>> ]
|
||||||
|
@ -177,8 +176,7 @@ TUPLE: class-partition integers not-integers simples not-simples and or other ;
|
||||||
[ and>> ]
|
[ and>> ]
|
||||||
[ or>> ]
|
[ or>> ]
|
||||||
[ other>> ]
|
[ other>> ]
|
||||||
} cleave
|
} cleave>array concat ;
|
||||||
] output>array concat ;
|
|
||||||
|
|
||||||
: repartition ( partition -- partition' )
|
: repartition ( partition -- partition' )
|
||||||
! This could be made more efficient; only and and or are effected
|
! This could be made more efficient; only and and or are effected
|
||||||
|
|
Loading…
Reference in New Issue