Arrays: Difference between revisions

726 bytes added ,  1 year ago
no edit summary
m (update for versions 1.0+)
No edit summary
Line 3,143:
iex(5)> tl(fruit) == [:banana, :cherry]
true</syntaxhighlight>
 
=={{header|EMal}}==
<syntaxhighlight lang="emal">
^|EMal has dynamic lists.
|Lists have differen API to change the value in-place or not.
|SQL like name: insert, append, delete, order alter the current list.
|There are methods that operate on indexes, other on values.
|^
List a = int[] # a:[]
a.append(8) # a:[8]
a.insert(1, 13) # a:[8,13]
a.delete(0) # a:[13]
a.clear() # a:[]
a.of(21, 33) # a:[21,33]
a[1] = 34 # a:[21,34]
List b = a.remove(21) # a:[21, 34], b:[34]
writeLine("a has " + a.length + " items, their values are " + a[0] + " " + a[1])
writeLine("b has " + b.length + " item, its value is " + b[0])
</syntaxhighlight>
{{out}}
<pre>
a has 2 items, their values are 21 34
b has 1 item, its value is 34
</pre>
 
=={{header|Erlang}}==
214

edits