Paste: 2d-index-replicate?
Author: | sf17k |
Mode: | factor |
Date: | Sun, 20 Mar 2011 21:40:46 |
Plain Text |
:: 2d-index-replicate
( ... x y quot: ( ... x y -- ... newelt ) -- ... newseq )
{ } clone x iota [ y iota [ [ dup ] dip 2array ] map nip append ] each
[ first2 ] quot compose map ;
:: generate-region-file ( -- )
32 32 [ generate-chunk ] 2d-index-replicate
;
Author: | mrjbq7 |
Mode: | factor |
Date: | Sun, 20 Mar 2011 21:46:14 |
Plain Text |
TUPLE: point x y z ;
: xyz ( point -- x y z )
[ x>> ] [ y>> ] [ z>> ] tri ; inline
: change-xyz ( point obj x: ( x obj -- x' ) y: ( y obj -- y' ) z: ( z obj -- z' ) -- point )
tri-curry [ change-x ] [ change-y ] [ change-z ] tri* ; inline
: init-point ( n -- point )
dup dup point boa ;
;
: make-points ( len -- points )
iota [ init-point ] map-index ;
Author: | sf17k |
Mode: | c |
Date: | Sun, 20 Mar 2011 21:50:11 |
Plain Text |
for(int x = x_off; x < x_off+16; x++)
for(int z = z_off; z < z_off+16; z++)
for(int y = 0; y < 128; y++){
data[x*16*16+z*16+y] = foobar(x,y,z);
}
Author: | mrjbq7 |
Mode: | factor |
Date: | Sun, 20 Mar 2011 21:55:43 |
Plain Text |
TUPLE: point x y z ;
: foobar ( x y z -- point )
point boa ;
: make-points ( -- points )
32 dup 16 [a,b)
32 dup 16 [a,b)
128 iota
[ foobar ] 3map ;
Author: | mrjbq7 |
Mode: | factor |
Date: | Sun, 20 Mar 2011 21:57:44 |
Plain Text |
: make-points ( -- points )
[
32 dup 16 [a,b) [
32 dup 16 [a,b) [
128 [0,b) [
foobar ,
]
]
]
] { } make ;
Author: | mrjbq7 |
Mode: | factor |
Date: | Sun, 20 Mar 2011 21:58:14 |
Plain Text |
: make-points ( -- points )
[
32 dup 16 [a,b) [
32 dup 16 [a,b) [
128 [0,b) [
foobar ,
] each
] each
] each
] { } make ;
New Annotation