aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/common/lib/forth2012/facility/structures-array.frt
blob: 14e62df251340aecd952e3060052768e95476d50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

begin-structure hash
    field: hash.key
    field: hash.value
end-structure

\ inspired by CELLS
: hash-cells hash * ;

\ define a hash-array
: hash:
     hash-cells buffer:
   does>
     swap hash-cells  + 
;

\ define an array of some elements hash'es
4 hash: my-hash
cr 0 my-hash .
cr 1 my-hash .

\ store a key/value pair 
42 3 my-hash hash.key !
4711 3 my-hash hash.value !