File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # hash_table.tri — Pilot migration from Trinity tri_hash_table.tri
2+ # Format: zig-golden-float Level 5 (Data Structures)
3+ format: HASH_TABLE
4+ version: 1
5+ level: 5
6+ type: data_structure
7+
8+ description: |
9+ Open-addressing hash table with linear probing.
10+ Integer keys, i64 values. Allocator-aware.
11+
12+ storage:
13+ underlying: struct
14+ alignment: 8
15+
16+ types:
17+ Entry:
18+ fields:
19+ - name: key
20+ type: usize
21+ - name: value
22+ type: i64
23+ - name: used
24+ type: bool
25+
26+ HashTable:
27+ fields:
28+ - name: buckets
29+ type: "[]Entry"
30+ - name: capacity
31+ type: usize
32+ - name: size
33+ type: usize
34+ - name: allocator
35+ type: std.mem.Allocator
36+
37+ ops:
38+ init:
39+ inputs: [std.mem.Allocator, usize]
40+ output: "!HashTable"
41+ description: "Create hash table with initial capacity"
42+ deinit:
43+ inputs: ["*HashTable"]
44+ output: void
45+ description: "Free all buckets"
46+ put:
47+ inputs: ["*HashTable", usize, i64]
48+ output: "!void"
49+ description: "Insert or update key-value pair"
50+ get:
51+ inputs: ["*const HashTable", usize]
52+ output: "?i64"
53+ description: "Lookup value by key, null if missing"
54+ remove:
55+ inputs: ["*HashTable", usize]
56+ output: bool
57+ description: "Remove entry by key, return true if found"
58+ count:
59+ inputs: ["*const HashTable"]
60+ output: usize
61+ description: "Return number of stored entries"
Original file line number Diff line number Diff line change 1+ # geo_hash2d.tri — 2D Geohash spatial index
2+ format: GEO_HASH_2D
3+ version: 1
4+ level: 5
5+ type: data_structure
6+
7+ types:
8+ GeoCoord:
9+ fields:
10+ - name: lat
11+ type: f64
12+ - name: lon
13+ type: f64
14+ GeoHash:
15+ fields:
16+ - name: hash
17+ type: u64
18+ - name: precision
19+ type: u8
20+ BoundingBox:
21+ fields:
22+ - name: min_lat
23+ type: f64
24+ - name: max_lat
25+ type: f64
26+ - name: min_lon
27+ type: f64
28+ - name: max_lon
29+ type: f64
30+
31+ ops:
32+ encode:
33+ inputs: [GeoCoord, u8]
34+ output: GeoHash
35+ description: "Encode lat/lon to geohash with given precision"
36+ decode:
37+ inputs: [GeoHash]
38+ output: BoundingBox
39+ description: "Decode geohash to bounding box"
40+ neighbors:
41+ inputs: [GeoHash]
42+ output: "[8]GeoHash"
43+ description: "Get 8 adjacent geohash cells"
44+ distance:
45+ inputs: [GeoCoord, GeoCoord]
46+ output: f64
47+ description: "Haversine distance in meters"
48+ commonPrefix:
49+ inputs: [GeoHash, GeoHash]
50+ output: u8
51+ description: "Common prefix length (proximity measure)"
You can’t perform that action at this time.
0 commit comments