00001 #include "MusimatTutorial.h" 00002 MusimatTutorialSection(B0107) { 00003 Print("*** B.1.7 Lists ***"); 00004 /***************************************************************************** 00005 00006 B.1.7 Lists 00007 00008 We can group sets of variables to keep track of their relations. 00009 An IntegerList represents a collection of Integer expressions, for example, 00010 *****************************************************************************/ 00011 00012 IntegerList iL(1, 1+1, 3, 5-1); 00013 00014 /***************************************************************************** 00015 defines a list iL containing the integers 1 through 4. 00016 A RealList represents a collection of Real expressions: 00017 *****************************************************************************/ 00018 00019 RealList rL(1.1, 2.2, 3.3, 4.4); 00020 00021 /***************************************************************************** 00022 We can print these lists as follows. 00023 *****************************************************************************/ 00024 00025 Print("iL=", iL); 00026 Print("rL=", rL); 00027 00028 /***************************************************************************** 00029 We can obtain the length of a list of any type. For example, 00030 *****************************************************************************/ 00031 00032 Integer n = Length(rL); 00033 Print(n); 00034 00035 /***************************************************************************** 00036 prints 4. 00037 00038 The value can be seen when running this application in the console window 00039 if the output of this application has not been redirected. 00040 00041 *****************************************************************************/ 00042 } 00043 00045 /* $Revision: 1.2 $ $Date: 2006/09/05 06:32:25 $ $Author: dgl $ $Name: $ $Id: B0107.cpp,v 1.2 2006/09/05 06:32:25 dgl Exp $ */ 00046 // The Musimat Tutorial � 2006 Gareth Loy 00047 // Derived from Chapter 9 and Appendix B of "Musimathics Vol. 1" � 2006 Gareth Loy 00048 // and published exclusively by The MIT Press. 00049 // This program is released WITHOUT ANY WARRANTY; without even the implied 00050 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00051 // For information on usage and redistribution, and for a DISCLAIMER OF ALL 00052 // WARRANTIES, see the file, "LICENSE.txt," in this distribution. 00053 // "Musimathics" is available here: http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=10916 00054 // Gareth Loy's Musimathics website: http://www.musimathics.com/ 00055 // The Musimat website: http://www.musimat.com/ 00056 // This program is released under the terms of the GNU General Public License 00057 // available here: http://www.gnu.org/licenses/gpl.txt 00058