Multiple distinct objects: Difference between revisions
Content added Content deleted
(Added Rust) |
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
||
Line 237: | Line 237: | ||
(Or if no particular initialization is needed, skip that part, or use <tt>calloc</tt>.) |
(Or if no particular initialization is needed, skip that part, or use <tt>calloc</tt>.) |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|C++}}== |
=={{header|C++}}== |
||
Line 296: | Line 304: | ||
</lang> |
</lang> |
||
Of course, also in this case one can use the other sequence containers or plain new/delete instead of <tt>vector</tt>. |
Of course, also in this case one can use the other sequence containers or plain new/delete instead of <tt>vector</tt>. |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Clojure}}== |
=={{header|Clojure}}== |
||
Line 397: | Line 397: | ||
Randoms = [random:uniform(1000) || _ <- lists:seq(1,10)]. |
Randoms = [random:uniform(1000) || _ <- lists:seq(1,10)]. |
||
</pre> |
</pre> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
Line 432: | Line 447: | ||
list each: drop . 1301600 |
list each: drop . 1301600 |
||
</lang> |
</lang> |
||
=={{header|Fortran}}== |
=={{header|Fortran}}== |
||
Line 481: | Line 495: | ||
</lang> |
</lang> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Go}}== |
=={{header|Go}}== |
||
Useful: |
Useful: |
||
Line 664: | Line 664: | ||
<lang JavaScript>[{"index":0}, {"index":1}, {"index":2}, {"index":3}, |
<lang JavaScript>[{"index":0}, {"index":1}, {"index":2}, {"index":3}, |
||
{"index":4}, {"index":5}, {"index":6}]</lang> |
{"index":4}, {"index":5}, {"index":6}]</lang> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|jq}}== |
=={{header|jq}}== |
||
Line 697: | Line 686: | ||
Array("object"; 4)</lang> |
Array("object"; 4)</lang> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |
||
Line 1,044: | Line 1,044: | ||
<lang perl>map { Foo->new } 1 .. $n;</lang> |
<lang perl>map { Foo->new } 1 .. $n;</lang> |
||
which evaluates <tt>Foo->new</tt> <var>$n</var> times and collects each result in a list. |
which evaluates <tt>Foo->new</tt> <var>$n</var> times and collects each result in a list. |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
Line 1,170: | Line 1,162: | ||
(build-list 10 (λ (n) (make-vector 10 0))) |
(build-list 10 (λ (n) (make-vector 10 0))) |
||
</lang> |
</lang> |
||
⚫ | |||
(formerly Perl 6) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
Line 1,236: | Line 1,237: | ||
(0 1 2 3 4) |
(0 1 2 3 4) |
||
</pre> |
</pre> |
||
=={{header|Seed7}}== |
=={{header|Seed7}}== |