3 ms·
This is function operating on values with slightly relaxed type checks. Default mode in dynamic languages: let list_add = (n, prev, next) => { prev[1
by sergeykish 6y ago
This is function operating on values with slightly relaxed type checks. Default mode in dynamic languages:
let list_add = (n, prev, next) => {
prev[1] = n
n[1] = next
n[0] = prev
if (next) next[0] = n
}
foo = [null, null, 3]
bar = [null, null, 5]
list_add(bar, foo, null)
Looks a bit cooler with C structs names as offset.
Inheritance would be building container hierarchy on top of that. Could be brittle in any language.