:: combinations-quot ( seq k quot -- seq quot' )
seq length :> n
- n k nCk <iota> k iota >array seq quot n
+ n k nCk <iota> k <iota> >array seq quot n
'[ drop _ [ _ nths-unsafe @ ] keep _ next-combination drop ] ; inline
PRIVATE>
[ color-map [ length mod ] keep nth ] [ B{ 0 0 0 } ] if* ; inline
: render ( -- )
- height <iota> [ width iota swap '[ _ c pixel color write ] each ] each ; inline
+ height <iota> [ width <iota> swap '[ _ c pixel color write ] each ] each ; inline
: ppm-header ( -- )
ascii encode-output
[ oversampling /f ] bi@ 0.0 double-array{ } 3sequence ;
: ss-grid ( -- ss-grid )
- oversampling <iota> [ oversampling iota [ ss-point ] with map ] map ;
+ oversampling <iota> [ oversampling <iota> [ ss-point ] with map ] map ;
: ray-grid ( point ss-grid -- ray-grid )
[
faded trilerp ;
MEMO: perlin-noise-map-coords ( dim -- coords )
- first2 <iota> [| x y | x iota [ y 0.0 0.0 float-4-boa ] float-4-array{ } map-as ] with map concat ;
+ first2 <iota> [| x y | x <iota> [ y 0.0 0.0 float-4-boa ] float-4-array{ } map-as ] with map concat ;
TYPED:: perlin-noise-map ( table: byte-array transform: matrix4 coords: float-4-array -- map: float-array )
coords [| coord | table transform coord m4.v perlin-noise ] data-map( float-4 -- c:float )