1 ! Copyright (C) 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors fry generalizations kernel macros math.order
7 MACRO: output>sequence ( quot exemplar -- newquot )
8 [ dup infer out>> ] dip
11 : output>array ( quot -- newquot )
12 { } output>sequence ; inline
14 MACRO: input<sequence ( quot -- newquot )
18 MACRO: reduce-outputs ( quot operation -- newquot )
19 [ dup infer out>> 1 [-] ] dip n*quot compose ;
21 : sum-outputs ( quot -- n )
22 [ + ] reduce-outputs ; inline
24 MACRO: append-outputs-as ( quot exemplar -- newquot )
25 [ dup infer out>> ] dip '[ @ _ _ nappend-as ] ;
27 : append-outputs ( quot -- seq )
28 { } append-outputs-as ; inline