Collections: Difference between revisions
Content added Content deleted
No edit summary |
mNo edit summary |
||
Line 1,542: | Line 1,542: | ||
The result (or output) of this sequence is [10,1,2], so it is convenient to |
The result (or output) of this sequence is [10,1,2], so it is convenient to |
||
speak of the operation ".[0] = 10" as simply a filter that sets the element at 0 to 10. |
speak of the operation ".[0] = 10" as simply a filter that sets the element at 0 to 10. |
||
=={{header|Julia}}== |
|||
Julia has a wide variety of collections, including vectors, matrices, lists of Any data type, associative arrays, and bitsets. |
|||
There is a slicing notation similar to Python, but the base index is by default 1, not 0. In Julia, a collection is a just variable length array: |
|||
<lang julia> |
|||
julia> collection = [] |
|||
0-element Array{Any,1} |
|||
julia> push!(collection, 1,2,4,7) |
|||
4-element Array{Any,1}: |
|||
1 |
|||
2 |
|||
4 |
|||
7 |
|||
</lang> |
|||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |