[ infer in>> ] keep
'[ _ firstn @ ] ;
+MACRO: input<sequence-unsafe ( quot -- newquot )
+ [ infer in>> ] keep
+ '[ _ firstn-unsafe @ ] ;
+
MACRO: reduce-outputs ( quot operation -- newquot )
[ dup infer out>> 1 [-] ] dip n*quot compose ;
MACRO: nsum ( n -- )
1- [ + ] n*quot ;
+MACRO: firstn-unsafe ( n -- )
+ [ '[ [ _ ] dip nth-unsafe ] ] map '[ _ cleave ] ;
+
MACRO: firstn ( n -- )
dup zero? [ drop [ drop ] ] [
- [ [ '[ [ _ ] dip nth-unsafe ] ] map ]
- [ 1- '[ [ _ ] dip bounds-check 2drop ] ]
- bi prefix '[ _ cleave ]
+ [ 1- swap bounds-check 2drop ]
+ [ firstn-unsafe ]
+ bi-curry '[ _ _ bi ]
] if ;
MACRO: npick ( n -- )