DreamBerd
DreamBerd copied to clipboard
Interpolation at indexing
There's a code example where values are associated with non-integer indexes:
const var scores = [3, 2, 5]!
scores[0.5] = 4
print(scores) //[3, 2, 4, 5]!
That's cool but there's a crucial ergonomic issue: what if the value at index 0.5 has never been assigned but a user wants to get a reasonable result for the indexing operation?
In this case, we obviously need to do some AI interpolation (or an arithmetic mean as a temporary solution)