Multiple distinct objects: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
Mercerenies (talk | contribs) (Latitude language added) |
||
Line 735: | Line 735: | ||
4 |
4 |
||
</pre> |
</pre> |
||
=={{header|Latitude}}== |
|||
We construct an array of the appropriate length and then replace each element with a new object. |
|||
<lang latitude>arr := n times to (Array) map { Object clone. }.</lang> |
|||
We can verify that these are in fact distinct objects by checking their ID. |
|||
<lang latitude>;; Will print 10 distinct, arbitrary numbers. |
|||
arr visit { |
|||
Kernel id printObject. |
|||
}.</lang> |
|||
=={{header|Logtalk}}== |
=={{header|Logtalk}}== |