Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
USING: accessors arrays.shaped io kernel prettyprint sequences ;
|
||||
|
||||
! Create a 4-dimensional array with increasing elements.
|
||||
{ 2 3 4 5 } increasing
|
||||
|
||||
! Check if an index is in bounds.
|
||||
{ 0 0 0 0 } over shaped-bounds-check
|
||||
|
||||
! Access and print the first element.
|
||||
"First element: " write
|
||||
get-shaped-row-major .
|
||||
|
||||
! Set the first element and show the array.
|
||||
"With first element set to 999:" print
|
||||
999 { 0 0 0 0 } pick set-shaped-row-major dup .
|
||||
|
||||
! Reshape and show the array.
|
||||
"Reshaped: " print
|
||||
{ 5 4 3 2 } reshape .
|
||||
Loading…
Add table
Add a link
Reference in a new issue