: ones ( shape -- shaped-array ) 1 repeated-shaped ;
: increasing ( shape -- shaped-array )
- [ shape-capacity iota >array ] [ ] bi <shaped-array> ;
+ [ shape-capacity <iota> >array ] [ ] bi <shaped-array> ;
: decreasing ( shape -- shaped-array )
- [ shape-capacity iota <reversed> >array ] [ ] bi <shaped-array> ;
+ [ shape-capacity <iota> <reversed> >array ] [ ] bi <shaped-array> ;
: row-length ( shape -- n ) rest-slice product ; inline
! : set-shaped-where ( .. elt sa quot -- )
! [
- ! [ underlying>> [ length iota ] keep zip ]
+ ! [ underlying>> [ length <iota> ] keep zip ]
! [ ] bi
! ] dip '[ _ [ _ set- ] @ ] assoc-each ; inline
block-array boa ;
: iteration-indices ( shaped -- seq )
- [ iota ] [
+ [ <iota> ] [
cartesian-product concat
[ dup first array? [ first2 suffix ] when ] map
] map-reduce ;