Retoor software development Projects Research SearchXNG
Register Sign In

8 lines
146 B
Plaintext
Raw Normal View History

feat: add list clear and insert primitives with capacity growth and index validation Extract inline list growth logic into `ensureListCapacity` helper and add `validateIndex` function supporting negative indices. Implement `list_clear` primitive that resets count to zero without freeing memory, and `list_insert` primitive that shifts elements right and inserts at validated position. Add comprehensive test suites for both operations covering empty lists, normal/negative indices, and return values.
2013-11-27 08:11:11 +01:00
var a = [1, 2, 3]
a.clear
io.write(a) // expect: []
io.write(a.count) // expect: 0
// Returns null.
io.write([1, 2].clear) // expect: null
Reference in New Issue Copy Permalink
0496b4e79d
wren/test/list/clear.wren
Response time: 22ms
Mail Licenses API