Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
[ ( x y -- address )
|
||||
cells malloc >r
|
||||
dup cells >r
|
||||
[ r> r> r> 2dup >r >r swap malloc swap i swap array.put >r ] iterate
|
||||
r> r> nip
|
||||
] is 2D-array
|
||||
|
||||
[ ( a b address -- value )
|
||||
array.get array.get
|
||||
] is 2D-get-element
|
||||
|
||||
[ ( value a b address -- )
|
||||
array.get array.put
|
||||
] is 2D-put-element
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
5 5 2D-array >r #! Create an array and save the pointer to it
|
||||
10 2 3 r@ 2D-put-element #! Set element 2,3 to 10
|
||||
2 3 r@ 2D-get-element #! Get the element at 2,3
|
||||
r> drop #! Discard the pointer to the array
|
||||
Loading…
Add table
Add a link
Reference in a new issue