Next / Previous / Index / TCC Help System / Publications / Site map / NM Tech homepage

Using the copy() function in Icon

Tech Computer Center logo

The ``copy'' function is used to create a duplicate of an aggregate structure. For example, if ``L'' is a list containing five things, ``copy(L)'' returns a new list containing the same five things.

You can use the ``copy()'' function to avoid modifying a structure that has been passed into a procedure. Be aware, though, that the copying only proceeds for one level. If ``L'' is a list containing five records, then ``copy(L)'' gives you a new list, but this new list effectively points to the same five records, so if you modify a field in one of those records, it will still affect the same record pointed at by list ``L''.

This ends our Icon tutorial. There are a lot more useful features, though. For more information, see `References for the Icon programming language'.


See also: Using data structures in Icon
Previous: Examples of structure passing in Icon
Site map
Index: Keyword index to help pages
Help: New Mexico Tech Computer Center: Help System
TCC Publications
Home: About New Mexico Tech

John Shipman, john@nmt.edu

Last updated: 1996/01/06 21:12:57 UT
URL: http://www.nmt.edu/tcc/help/lang/icon/copy.html