From 8bfed897a8226c8fa7c02f757d6fadd487217961 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 16 Sep 2012 17:32:27 -0700 Subject: [PATCH] combinators.smart: Add cleave>array. --- basis/combinators/smart/smart.factor | 6 +++++- basis/regexp/classes/classes.factor | 20 +++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/basis/combinators/smart/smart.factor b/basis/combinators/smart/smart.factor index e808f3e32e..81528c1823 100644 --- a/basis/combinators/smart/smart.factor +++ b/basis/combinators/smart/smart.factor @@ -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 : inputsequence ( 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