Set the item at index.

var a = [10,20,30]
a[1] = 200
assert a  == [10,200,30]

like with [], index should be between 0 and length-1 However, if index==length, []= works like push.

a[3] = 400
assert a  == [10,200,30,400]

REQUIRE index >= 0 and index <= length

Property definitions

core $ Sequence :: []=
	# Set the `item` at `index`.
	#
	#     var a = [10,20,30]
	#     a[1] = 200
	#     assert a  == [10,200,30]
	#
	# like with `[]`, index should be between `0` and `length-1`
	# However, if `index==length`, `[]=` works like `push`.
	#
	#     a[3] = 400
	#     assert a  == [10,200,30,400]
	#
	# REQUIRE `index >= 0 and index <= length`
	fun []=(index: Int, item: E) is abstract
lib/core/collection/abstract_collection.nit:1167,2--1180,41

core $ List :: []=
	redef fun []=(index, item) do get_node(index).as(not null).item = item
lib/core/collection/list.nit:26,2--71

core $ CircularArray :: []=
	redef fun []=(index, item) do
		var l = length
		if index == l then
			push(item)
			return
		end
		native[offset(index)] = item
	end
lib/core/collection/circular_array.nit:91,2--98,4

more_collections $ UnrolledList :: []=
	redef fun []=(index, value)
	do
		var node = node_at(index)
		index = index_within_node + node.head_index
		node.items[index] = value
	end
lib/more_collections/more_collections.nit:420,2--425,4

dom $ XMLEntities :: []=
	redef fun []=(index, el) do
		var olde = self[index]
		var olde_parent = olde.parent
		if olde_parent != null then
			olde_parent.children.remove(el)
		end
		entities[index] = el
		el.set_parent owner
	end
lib/dom/xml_entities.nit:70,2--78,4

core $ FlatBufferCharView :: []=
	redef fun []=(index, item)
	do
		assert index >= 0 and index <= length
		if index == length then
			add(item)
			return
		end
		target[index] = item
	end
lib/core/text/flat.nit:1244,2--1252,4

pthreads $ ConcurrentSequence :: []=
	redef fun []=(index, e)
	do
		mutex.lock
		real_collection[index] = e
		mutex.unlock
	end
lib/pthreads/concurrent_collections.nit:284,2--289,4

core $ Array :: []=
	redef fun []=(index, item)
	do
		assert index: index >= 0 and index < _length + 1
		if _capacity <= index then
			enlarge(index + 1)
		end
		if _length <= index then
			_length = index + 1
		end
		_items.as(not null)[index] = item
	end
lib/core/collection/array.nit:327,2--337,4

pthreads :: redef_collections $ Array :: []=
	redef fun []=(index, e)
	do
		mutex.lock
		super
		mutex.unlock
	end
lib/pthreads/redef_collections.nit:47,2--52,4

core $ Bytes :: []=
	#     var b = new Bytes.with_capacity(1)
	#     b[0] = 101
	#     assert b.to_s == "e"
	redef fun []=(i, v) do
		if persisted then regen
		assert i >= 0
		assert i <= length
		if i == length then add(v)
		items[i] = v
	end
lib/core/bytes.nit:503,2--512,4