phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0
This commit is contained in:
32
apps/lib/boxes/map_std.hako
Normal file
32
apps/lib/boxes/map_std.hako
Normal file
@ -0,0 +1,32 @@
|
||||
// MapStd — minimal standard map helpers (commonized API)
|
||||
|
||||
static box MapStd {
|
||||
size(m) {
|
||||
if m == null { return 0 }
|
||||
if m.size { return m.size() }
|
||||
return 0
|
||||
}
|
||||
has(m, key) {
|
||||
if m == null { return 0 }
|
||||
if m.has { return m.has(key) }
|
||||
// fallback: compare get() to null
|
||||
if m.get { return m.get(key) != null ? 1 : 0 }
|
||||
return 0
|
||||
}
|
||||
get(m, key) {
|
||||
if m == null { return null }
|
||||
if m.get { return m.get(key) }
|
||||
return null
|
||||
}
|
||||
set(m, key, val) {
|
||||
if m == null { return 0 }
|
||||
if m.set { m.set(key, val) return 0 }
|
||||
return 0
|
||||
}
|
||||
toString(m) {
|
||||
if m == null { return "{}" }
|
||||
if m.toString { return m.toString() }
|
||||
return "{}"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user