selfhost/runtime: Stage 0-1 runner + MIR JSON loader (summary) with trace; compiler: scopebox/loopform prepass wiring (flags, child args); libs: add P1 standard boxes (console/string/array/map) as thin wrappers; runner: pass --box-pref via env; ops_calls dispatcher skeleton; docs: selfhost executor roadmap + scopebox/loopform notes; smokes: selfhost runner + identity prepasses; CURRENT_TASK: update plan and box lib schedule
This commit is contained in:
33
apps/lib/boxes/array_std.nyash
Normal file
33
apps/lib/boxes/array_std.nyash
Normal file
@ -0,0 +1,33 @@
|
||||
// ArrayStd — minimal standard array helpers (commonized API)
|
||||
|
||||
static box ArrayStd {
|
||||
size(a) {
|
||||
if a == null { return 0 }
|
||||
// support both size/len
|
||||
if a.size { return a.size() }
|
||||
if a.len { return a.len() }
|
||||
return 0
|
||||
}
|
||||
len(a) { return me.size(a) }
|
||||
get(a, i) {
|
||||
if a == null { return null }
|
||||
if a.get { return a.get(i) }
|
||||
return null
|
||||
}
|
||||
set(a, i, v) {
|
||||
if a == null { return 0 }
|
||||
if a.set { a.set(i, v) return 0 }
|
||||
return 0
|
||||
}
|
||||
push(a, v) {
|
||||
if a == null { return 0 }
|
||||
if a.push { return a.push(v) }
|
||||
return 0
|
||||
}
|
||||
toString(a) {
|
||||
if a == null { return "[]" }
|
||||
if a.toString { return a.toString() }
|
||||
return "[]"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user