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