File: lists.chapt.txt

package info (click to toggle)
yacas 1.3.6-2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 7,176 kB
  • ctags: 3,520
  • sloc: cpp: 13,960; java: 12,602; sh: 11,401; makefile: 552; perl: 517; ansic: 381
file content (1687 lines) | stat: -rw-r--r-- 36,294 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687

			List operations

*INTRO
Most objects that can be of variable size are represented as lists
(linked lists internally). Yacas does implement arrays, which are
faster when the number of elements in a collection of objects doesn't
change. Operations on lists have better support in the current
system.

*CMD Head --- the first element of a list
*CORE
*CALL
	Head(list)

*PARMS

{list} -- a list

*DESC

This function returns the first element of a list. If it is applied to
a general expression, it returns the first operand. An error is
returned if "list" is an atom.

*E.G.

	In> Head({a,b,c})
	Out> a;
	In> Head(f(a,b,c));
	Out> a;

*SEE Tail, Length

*CMD Tail --- returns a list without its first element
*CORE
*CALL
	Tail(list)

*PARMS

{list} -- a list

*DESC

This function returns "list" without its first element.

*E.G.

	In> Tail({a,b,c})
	Out> {b,c};

*SEE Head, Length

*CMD Length --- the length of a list or string
*CORE
*CALL
	Length(object)

*PARMS

{object} -- a list, array or string

*DESC

Length returns the length of a list.
This function also works on strings and arrays.

*E.G.

	In> Length({a,b,c})
	Out> 3;
	In> Length("abcdef");
	Out> 6;

*SEE Head, Tail, Nth, Count

*CMD Map --- apply an $n$-ary function to all entries in a list
*STD
*CALL
	Map(fn, list)

*PARMS

{fn} -- function to apply

{list} -- list of lists of arguments

*DESC

This function applies "fn" to every list of arguments to be found in
"list". So the first entry of "list" should be a list containing
the first, second, third, ... argument to "fn", and the same goes
for the other entries of "list". The function can either be given as
a string or as a pure function (see Apply for more information on 
pure functions).

*E.G.

	In> MapSingle("Sin",{a,b,c});
	Out> {Sin(a),Sin(b),Sin(c)};
	In> Map("+",{{a,b},{c,d}});
	Out> {a+c,b+d};

*SEE MapSingle, MapArgs, Apply

*CMD MapSingle --- apply a unary function to all entries in a list
*STD
*CALL
	MapSingle(fn, list)

*PARMS

{fn} -- function to apply

{list} -- list of arguments

*DESC

The function "fn" is successively applied to all entries in
"list", and a list containing the respective results is
returned. The function can be given either as a string or as a pure
function (see Apply for more information on pure functions).

The {/@} operator provides a shorthand for
{MapSingle}.

*E.G.

	In> MapSingle("Sin",{a,b,c});
	Out> {Sin(a),Sin(b),Sin(c)};
	In> MapSingle({{x},x^2}, {a,2,c});
	Out> {a^2,4,c^2};

*SEE Map, MapArgs, /@, Apply


*CMD MakeVector --- vector of uniquely numbered variable names
*STD
*CALL
	MakeVector(var,n)

*PARMS

{var} -- free variable

{n} -- length of the vector

*DESC

A list of length "n" is generated. The first entry contains the
identifier "var" with the number 1 appended to it, the second entry
contains "var" with the suffix 2, and so on until the last entry
which contains "var" with the number "n" appended to it.

*E.G.

	In> MakeVector(a,3)
	Out> {a1,a2,a3};

*SEE RandomIntegerVector, ZeroVector

*CMD Select --- select entries satisfying some predicate
*STD
*CALL
	Select(pred, list)

*PARMS

{pred} -- a predicate

{list} -- a list of elements to select from

*DESC

{Select} returns a sublist of "list" which contains all
the entries for which the predicate "pred" returns
{True} when applied to this entry.

*E.G.

	In> Select("IsInteger",{a,b,2,c,3,d,4,e,f})
	Out> {2,3,4};

*SEE Length, Find, Count

*CMD Nth --- return the $n$-th element of a list
*CORE
*CALL
	Nth(list, n)

*PARMS

{list} -- list to choose from

{n} -- index of entry to pick

*DESC

The entry with index "n" from "list" is returned. The first entry
has index 1. It is possible to pick several entries of the list by
taking "n" to be a list of indices.

More generally, {Nth} returns the n-th operand of the
expression passed as first argument.

An alternative but equivalent form of {Nth(list, n)} is
{list[n]}.

*E.G.

	In> lst := {a,b,c,13,19};
	Out> {a,b,c,13,19};
	In> Nth(lst, 3);
	Out> c;
	In> lst[3];
	Out> c;
	In> Nth(lst, {3,4,1});
	Out> {c,13,a};
	In> Nth(b*(a+c), 2);
	Out> a+c;

*SEE Select, Nth

*CMD DestructiveReverse --- reverse a list destructively
*CORE
*CALL
	DestructiveReverse(list)

*PARMS

{list} -- list to reverse

*DESC

This command reverses "list" in place, so that the original is
destroyed. This means that any variable bound to "list" will now have
an undefined content, and should not be used any more. 
The reversed list is returned.

Destructive commands are faster than their nondestructive
counterparts. {Reverse} is the non-destructive version of
this function.

*E.G.

	In> lst := {a,b,c,13,19};
	Out> {a,b,c,13,19};
	In> revlst := DestructiveReverse(lst);
	Out> {19,13,c,b,a};
	In> lst;
	Out> {a};

*SEE FlatCopy, Reverse






*CMD Reverse --- return the reversed list (without touching the original)
*STD
*CALL
	Reverse(list)

*PARMS

{list} -- list to reverse

*DESC

This function returns a list reversed, without changing the
original list. It is similar to {DestructiveReverse}, but safer
and slower.


*EG

	In> lst:={a,b,c,13,19}
	Out> {a,b,c,13,19};
	In> revlst:=Reverse(lst)
	Out> {19,13,c,b,a};
	In> lst
	Out> {a,b,c,13,19};

*SEE FlatCopy, DestructiveReverse













*CMD List --- construct a list
*CORE
*CALL
	List(expr1, expr2, ...)

*PARMS

{expr1}, {expr2} -- expressions making up the list

*DESC

A list is constructed whose first entry is "expr1", the second entry
is "expr2", and so on. This command is equivalent to the expression
"{expr1, expr2, ...}".

*E.G.

	In> List();
	Out> {};
	In> List(a,b);
	Out> {a,b};
	In> List(a,{1,2},d);
	Out> {a,{1,2},d};

*SEE UnList, Listify

*CMD UnList --- convert a list to a function application
*CORE
*CALL
	UnList(list)

*PARMS

{list} -- list to be converted

*DESC

This command converts a list to a function application. The first
entry of "list" is treated as a function atom, and the following entries
are the arguments to this function. So the function referred to in the
first element of "list" is applied to the other elements.

Note that "list" is evaluated before the function application is
formed, but the resulting expression is left unevaluated. The functions {UnList()} and {Hold()} both stop the process of evaluation.

*E.G.

	In> UnList({Cos, x});
	Out> Cos(x);
	In> UnList({f});
	Out> f();
	In> UnList({Taylor,x,0,5,Cos(x)});
	Out> Taylor(x,0,5)Cos(x);
	In> Eval(%);
	Out> 1-x^2/2+x^4/24;

*SEE List, Listify, Hold

*CMD Listify --- convert a function application to a list
*CORE
*CALL
	Listify(expr)

*PARMS

{expr} -- expression to be converted

*DESC

The parameter "expr" is expected to be a compound object, i.e. not
an atom. It is evaluated and then converted to a list. The first entry
in the list is the top-level operator in the evaluated expression and
the other entries are the arguments to this operator. Finally, the
list is returned.

*E.G.

	In> Listify(Cos(x));
	Out> {Cos,x};
	In> Listify(3*a);
	Out> {*,3,a};

*SEE List, UnList, IsAtom

*CMD Concat --- concatenate lists
*CORE
*CALL
	Concat(list1, list2, ...)

*PARMS

{list1}, {list2}, ... -- lists to concatenate

*DESC

The lists "list1", "list2", ... are evaluated and
concatenated. The resulting big list is returned.

*E.G.

	In> Concat({a,b}, {c,d});
	Out> {a,b,c,d};
	In> Concat({5}, {a,b,c}, {{f(x)}});
	Out> {5,a,b,c,{f(x)}};

*SEE ConcatStrings, :, Insert

*CMD Delete --- delete an element from a list
*CORE
*CALL
	Delete(list, n)

*PARMS

{list} -- list from which an element should be removed

{n} -- index of the element to remove

*DESC

This command deletes the n-th element from "list". The first
parameter should be a list, while "n" should be a positive integer
less than or equal to the length of "list". The entry with index
"n" is removed (the first entry has index 1), and the resulting list
is returned.

*E.G.

	In> Delete({a,b,c,d,e,f}, 4);
	Out> {a,b,c,e,f};

*SEE DestructiveDelete, Insert, Replace

*CMD Insert --- insert an element into a list
*CORE
*CALL
	Insert(list, n, expr)

*PARMS

{list} -- list in which "expr" should be inserted

{n} -- index at which to insert

{expr} -- expression to insert in "list"

*DESC

The expression "expr" is inserted just before the n-th entry in
"list". The first parameter "list" should be a list, while "n"
should be a positive integer less than or equal to the length of
"list" plus one. The expression "expr" is placed between the
entries in "list" with entries "n-1" and "n". There are two
border line cases: if "n" is 1, the expression "expr" is placed in
front of the list (just as by the {:} operator); if "n"
equals the length of "list" plus one, the expression "expr" is
placed at the end of the list (just as by {Append}). In any
case, the resulting list is returned.

*E.G.

	In> Insert({a,b,c,d}, 4, x);
	Out> {a,b,c,x,d};
	In> Insert({a,b,c,d}, 5, x);
	Out> {a,b,c,d,x};
	In> Insert({a,b,c,d}, 1, x);
	Out> {x,a,b,c,d};

*SEE DestructiveInsert, :, Append, Delete, Remove

*CMD DestructiveDelete --- delete an element destructively from a list
*CORE
*CALL
	DestructiveDelete(list, n)

*PARMS

{list} -- list from which an element should be removed

{n} -- index of the element to remove

*DESC

This is the destructive counterpart of {Delete}. This
command yields the same result as the corresponding call to
{Delete}, but the original list is modified. So if a
variable is bound to "list", it will now be bound to the list with
the n-th entry removed.

Destructive commands run faster than their nondestructive counterparts
because the latter copy the list before they alter it.

*E.G.

	In> lst := {a,b,c,d,e,f};
	Out> {a,b,c,d,e,f};
	In> Delete(lst, 4);
	Out> {a,b,c,e,f};
	In> lst;
	Out> {a,b,c,d,e,f};
	In> DestructiveDelete(lst, 4);
	Out> {a,b,c,e,f};
	In> lst;
	Out> {a,b,c,e,f};

*SEE Delete, DestructiveInsert, DestructiveReplace

*CMD DestructiveInsert --- insert an element destructively into a list
*CORE
*CALL
	DestructiveInsert(list, n, expr)

*PARMS

{list} -- list in which "expr" should be inserted

{n} -- index at which to insert

{expr} -- expression to insert in "list"

*DESC

This is the destructive counterpart of {Insert}. This
command yields the same result as the corresponding call to
{Insert}, but the original list is modified. So if a
variable is bound to "list", it will now be bound to the list with
the expression "expr" inserted.

Destructive commands run faster than their nondestructive counterparts
because the latter copy the list before they alter it.

*E.G.

	In> lst := {a,b,c,d};
	Out> {a,b,c,d};
	In> Insert(lst, 2, x);
	Out> {a,x,b,c,d};
	In> lst;
	Out> {a,b,c,d};
	In> DestructiveInsert(lst, 2, x);
	Out> {a,x,b,c,d};
	In> lst;
	Out> {a,x,b,c,d};

*SEE Insert, DestructiveDelete, DestructiveReplace

*CMD Replace --- replace an entry in a list

*CORE

*CALL
	Replace(list, n, expr)

*PARMS

{list} -- list of which an entry should be replaced

{n} -- index of entry to replace

{expr} -- expression to replace the n-th entry with

*DESC

The n-th entry of "list" is replaced by the expression
"expr". This is equivalent to calling {Delete} and
{Insert} in sequence. To be precise, the expression
{Replace(list, n, expr)} has the same result as the
expression {Insert(Delete(list, n), n, expr)}.

*E.G.

	In> Replace({a,b,c,d,e,f}, 4, x);
	Out> {a,b,c,x,e,f};

*SEE Delete, Insert, DestructiveReplace

*CMD DestructiveReplace --- replace an entry destructively in a list

*CORE

*CALL
	DestructiveReplace(list, n, expr)

*PARMS

{list} -- list of which an entry should be replaced

{n} -- index of entry to replace

{expr} -- expression to replace the n-th entry with

*DESC

This is the destructive counterpart of {Replace}. This
command yields the same result as the corresponding call to
{Replace}, but the original list is modified. So if a
variable is bound to "list", it will now be bound to the list with
the expression "expr" inserted.

Destructive commands run faster than their nondestructive counterparts
because the latter copy the list before they alter it.

*E.G.

	In> lst := {a,b,c,d,e,f};
	Out> {a,b,c,d,e,f};
	In> Replace(lst, 4, x);
	Out> {a,b,c,x,e,f};
	In> lst;
	Out> {a,b,c,d,e,f};
	In> DestructiveReplace(lst, 4, x);
	Out> {a,b,c,x,e,f};
	In> lst;
	Out> {a,b,c,x,e,f};

*SEE Replace, DestructiveDelete, DestructiveInsert

*CMD FlatCopy --- copy the top level of a list
*CORE
*CALL
	FlatCopy(list)

*PARMS

{list} -- list to be copied

*DESC

A copy of "list" is made and returned. The list is not recursed
into, only the first level is copied. This is useful in combination
with the destructive commands that actually modify lists in place (for
efficiency).

*E.G.

The following shows a possible way to define a command that reverses a
list nondestructively.

	In> reverse(l_IsList) <-- DestructiveReverse \
	  (FlatCopy(l));
	Out> True;
	In> lst := {a,b,c,d,e};
	Out> {a,b,c,d,e};
	In> reverse(lst);
	Out> {e,d,c,b,a};
	In> lst;
	Out> {a,b,c,d,e};

*CMD Contains --- test whether a list contains a certain element
*STD
*CALL
	Contains(list, expr)

*PARMS

{list} -- list to examine

{expr} -- expression to look for in "list"

*DESC

This command tests whether "list" contains the expression "expr"
as an entry. It returns {True} if it does and
{False} otherwise. Only the top level of "list" is
examined. The parameter "list" may also be a general expression, in
that case the top-level operands are tested for the occurrence of
"expr".

*E.G.

	In> Contains({a,b,c,d}, b);
	Out> True;
	In> Contains({a,b,c,d}, x);
	Out> False;
	In> Contains({a,{1,2,3},z}, 1);
	Out> False;
	In> Contains(a*b, b);
	Out> True;

*SEE Find, Count

*CMD Find --- get the index at which a certain element occurs
*STD
*CALL
	Find(list, expr)

*PARMS

{list} -- the list to examine

{expr} -- expression to look for in "list"

*DESC

This commands returns the index at which the expression "expr"
occurs in "list". If "expr" occurs more than once, the lowest
index is returned. If "expr" does not occur at all,
{-1} is returned.

*E.G.

	In> Find({a,b,c,d,e,f}, d);
	Out> 4;
	In> Find({1,2,3,2,1}, 2);
	Out> 2;
	In> Find({1,2,3,2,1}, 4);
	Out> -1;

*SEE Contains

*CMD Append --- append an entry at the end of a list
*STD
*CALL
	Append(list, expr)

*PARMS

{list} -- list to append "expr" to

{expr} -- expression to append to the list

*DESC

The expression "expr" is appended at the end of "list" and the
resulting list is returned.

Note that due to the underlying data structure, the time it takes to
append an entry at the end of a list grows linearly with the length of
the list, while the time for prepending an entry at the beginning is
constant.

*E.G.

	In> Append({a,b,c,d}, 1);
	Out> {a,b,c,d,1};

*SEE Concat, :, DestructiveAppend

*CMD DestructiveAppend --- destructively append an entry to a list
*CORE
*CALL
	DestructiveAppend(list, expr)

*PARMS

{list} -- list to append "expr" to

{expr} -- expression to append to the list

*DESC

This is the destructive counterpart of {Append}. This
command yields the same result as the corresponding call to
{Append}, but the original list is modified. So if a
variable is bound to "list", it will now be bound to the list with
the expression "expr" inserted.

Destructive commands run faster than their nondestructive counterparts
because the latter copy the list before they alter it.

*E.G.

	In> lst := {a,b,c,d};
	Out> {a,b,c,d};
	In> Append(lst, 1);
	Out> {a,b,c,d,1};
	In> lst
	Out> {a,b,c,d};
	In> DestructiveAppend(lst, 1);
	Out> {a,b,c,d,1};
	In> lst;
	Out> {a,b,c,d,1};

*SEE Concat, :, Append

*CMD RemoveDuplicates --- remove any duplicates from a list
*STD
*CALL
	RemoveDuplicates(list)

*PARMS

{list} -- list to act on

*DESC

This command removes all duplicate elements from a given list and returns the resulting list.
To be
precise, the second occurrence of any entry is deleted, as are the
third, the fourth, etc.

*E.G.

	In> RemoveDuplicates({1,2,3,2,1});
	Out> {1,2,3};
	In> RemoveDuplicates({a,1,b,1,c,1});
	Out> {a,1,b,c};

*CMD Push --- add an element on top of a stack
*STD
*CALL
	Push(stack, expr)

*PARMS

{stack} -- a list (which serves as the stack container)

{expr} -- expression to push on "stack"

*DESC

This is part of a simple implementation of a stack, internally
represented as a list. This command pushes the expression "expr" on
top of the stack, and returns the stack afterwards.

*E.G.

	In> stack := {};
	Out> {};
	In> Push(stack, x);
	Out> {x};
	In> Push(stack, x2);
	Out> {x2,x};
	In> PopFront(stack);
	Out> x2;

*SEE Pop, PopFront, PopBack

*CMD Pop --- remove an element from a stack
*STD
*CALL
	Pop(stack, n)

*PARMS

{stack} -- a list (which serves as the stack container)

{n} -- index of the element to remove

*DESC

This is part of a simple implementation of a stack, internally
represented as a list. This command removes the element with index
"n" from the stack and returns this element. The top of the stack is
represented by the index 1. Invalid indices, for example indices
greater than the number of element on the stack, lead to an error.

*E.G.

	In> stack := {};
	Out> {};
	In> Push(stack, x);
	Out> {x};
	In> Push(stack, x2);
	Out> {x2,x};
	In> Push(stack, x3);
	Out> {x3,x2,x};
	In> Pop(stack, 2);
	Out> x2;
	In> stack;
	Out> {x3,x};

*SEE Push, PopFront, PopBack

*CMD PopFront --- remove an element from the top of a stack
*STD
*CALL
	PopFront(stack)

*PARMS

{stack} -- a list (which serves as the stack container)

*DESC

This is part of a simple implementation of a stack, internally
represented as a list. This command removes the element on the top of
the stack and returns it. This is the last element that is pushed onto
the stack.

*E.G.

	In> stack := {};
	Out> {};
	In> Push(stack, x);
	Out> {x};
	In> Push(stack, x2);
	Out> {x2,x};
	In> Push(stack, x3);
	Out> {x3,x2,x};
	In> PopFront(stack);
	Out> x3;
	In> stack;
	Out> {x2,x};

*SEE Push, Pop, PopBack

*CMD PopBack --- remove an element from the bottom of a stack
*STD
*CALL
	PopBack(stack)

*PARMS

{stack} -- a list (which serves as the stack container)

*DESC

This is part of a simple implementation of a stack, internally
represented as a list. This command removes the element at the bottom
of the stack and returns this element. Of course, the stack should not
be empty.

*E.G.

	In> stack := {};
	Out> {};
	In> Push(stack, x);
	Out> {x};
	In> Push(stack, x2);
	Out> {x2,x};
	In> Push(stack, x3);
	Out> {x3,x2,x};
	In> PopBack(stack);
	Out> x;
	In> stack;
	Out> {x3,x2};

*SEE Push, Pop, PopFront

*CMD Swap --- swap two elements in a list
*STD
*CALL
	Swap(list, i1, i2)

*PARMS

{list} -- the list in which a pair of entries should be swapped

{i1, i2} -- indices of the entries in "list" to swap

*DESC

This command swaps the pair of entries with entries "i1" and "i2"
in "list". So the element at index "i1" ends up at index "i2"
and the entry at "i2" is put at index "i1". Both indices should be
valid to address elements in the list. Then the updated list is
returned.

{Swap()} works also on generic arrays.

*E.G.

	In> lst := {a,b,c,d,e,f};
	Out> {a,b,c,d,e,f};
	In> Swap(lst, 2, 4);
	Out> {a,d,c,b,e,f};

*SEE Replace, DestructiveReplace, Array'Create

*CMD Count --- count the number of occurrences of an expression
*STD
*CALL
	Count(list, expr)

*PARMS

{list} -- the list to examine

{expr} -- expression to look for in "list"

*DESC

This command counts the number of times that the expression "expr"
occurs in "list" and returns this number.

*E.G.

	In> lst := {a,b,c,b,a};
	Out> {a,b,c,b,a};
	In> Count(lst, a);
	Out> 2;
	In> Count(lst, c);
	Out> 1;
	In> Count(lst, x);
	Out> 0;

*SEE Length, Select, Contains

*CMD Intersection --- return the intersection of two lists
*STD
*CALL
	Intersection(l1, l2)

*PARMS

{l1}, {l2} -- two lists

*DESC

The intersection of the lists "l1" and "l2" is determined and
returned. The intersection contains all elements that occur in both
lists. The entries in the result are listed in the same order as in
"l1". If an expression occurs multiple times in both "l1" and
"l2", then it will occur the same number of times in the result.

*E.G.

	In> Intersection({a,b,c}, {b,c,d});
	Out> {b,c};
	In> Intersection({a,e,i,o,u}, {f,o,u,r,t,e,e,n});
	Out> {e,o,u};
	In> Intersection({1,2,2,3,3,3}, {1,1,2,2,3,3});
	Out> {1,2,2,3,3};

*SEE Union, Difference

*CMD Union --- return the union of two lists
*STD
*CALL
	Union(l1, l2)

*PARMS

{l1}, {l2} -- two lists

*DESC

The union of the lists "l1" and "l2" is determined and
returned. The union contains all elements that occur in one or both of
the lists. In the resulting list, any element will occur only once.

*E.G.

	In> Union({a,b,c}, {b,c,d});
	Out> {a,b,c,d};
	In> Union({a,e,i,o,u}, {f,o,u,r,t,e,e,n});
	Out> {a,e,i,o,u,f,r,t,n};
	In> Union({1,2,2,3,3,3}, {2,2,3,3,4,4});
	Out> {1,2,3,4};

*SEE Intersection, Difference

*CMD Difference --- return the difference of two lists
*STD
*CALL
	Difference(l1, l2)

*PARMS

{l1}, {l2} -- two lists

*DESC

The difference of the lists "l1" and "l2" is determined and
returned. The difference contains all elements that occur in "l1"
but not in "l2". The order of elements in "l1" is preserved. If a
certain expression occurs "n1" times in the first list and "n2"
times in the second list, it will occur "n1-n2" times in the result
if "n1" is greater than "n2" and not at all otherwise.

*E.G.

	In> Difference({a,b,c}, {b,c,d});
	Out> {a};
	In> Difference({a,e,i,o,u}, {f,o,u,r,t,e,e,n});
	Out> {a,i};
	In> Difference({1,2,2,3,3,3}, {2,2,3,4,4});
	Out> {1,3,3};

*SEE Intersection, Union

*CMD FillList --- fill a list with a certain expression
*STD
*CALL
	FillList(expr, n)

*PARMS

{expr} -- expression to fill the list with

{n} -- the length of the list to construct

*DESC

This command creates a list of length "n" in which all slots contain
the expression "expr" and returns this list.

*E.G.

	In> FillList(x, 5);
	Out> {x,x,x,x,x};

*SEE MakeVector, ZeroVector, RandomIntegerVector

*CMD Drop --- drop a range of elements from a list

*STD

*CALL
	Drop(list, n)
	Drop(list, -n)
	Drop(list, {m,n})

*PARMS

{list} -- list to act on

{n}, {m} -- positive integers describing the entries to drop

*DESC

This command removes a sublist of "list" and returns a list
containing the remaining entries. The first calling sequence drops the
first "n" entries in "list". The second form drops the last "n"
entries. The last invocation drops the elements with indices "m"
through "n".

*E.G.

	In> lst := {a,b,c,d,e,f,g};
	Out> {a,b,c,d,e,f,g};
	In> Drop(lst, 2);
	Out> {c,d,e,f,g};
	In> Drop(lst, -3);
	Out> {a,b,c,d};
	In> Drop(lst, {2,4});
	Out> {a,e,f,g};

*SEE Take, Select, Remove

*CMD Take --- take a sublist from a list, dropping the rest
*STD
*CALL
	Take(list, n)
	Take(list, -n)
	Take(list, {m,n})

*PARMS

{list} -- list to act on

{n}, {m} -- positive integers describing the entries to take

*DESC

This command takes a sublist of "list", drops the rest, and returns
the selected sublist. The first calling sequence selects the first
"n" entries in "list". The second form takes the last "n"
entries. The last invocation selects the sublist beginning with entry
number "m" and ending with the "n"-th entry.

*E.G.

	In> lst := {a,b,c,d,e,f,g};
	Out> {a,b,c,d,e,f,g};
	In> Take(lst, 2);
	Out> {a,b};
	In> Take(lst, -3);
	Out> {e,f,g};
	In> Take(lst, {2,4});
	Out> {b,c,d};

*SEE Drop, Select, Remove

*CMD Partition --- partition a list in sublists of equal length
*STD
*CALL
	Partition(list, n)

*PARMS

{list} -- list to partition

{n} -- length of partitions

*DESC

This command partitions "list" into non-overlapping sublists of
length "n" and returns a list of these sublists. The first "n"
entries in "list" form the first partition, the entries from
position "n+1" up to "2n" form the second partition, and so on. If
"n" does not divide the length of "list", the remaining entries
will be thrown away. If "n" equals zero, an empty list is
returned.

*E.G.

	In> Partition({a,b,c,d,e,f,}, 2);
	Out> {{a,b},{c,d},{e,f}};
	In> Partition(1 .. 11, 3);
	Out> {{1,2,3},{4,5,6},{7,8,9}};

*SEE Take, Permutations

*CMD Assoc --- return element stored in association list
*STD
*CALL
	Assoc(key, alist)

*PARMS

{key} -- string, key under which element is stored

{alist} -- association list to examine

*DESC

The association list "alist" is searched for an entry stored with
index "key". If such an entry is found, it is returned. Otherwise
the atom {Empty} is returned.

Association lists are represented as a list of two-entry lists. The
first element in the two-entry list is the key, the second element is
the value stored under this key.

The call {Assoc(key, alist)} can (probably more
intuitively) be accessed as {alist[key]}.

*E.G.

	In> writer := {};
	Out> {};
	In> writer["Iliad"] := "Homer";
	Out> True;
	In> writer["Henry IV"] := "Shakespeare";
	Out> True;
	In> writer["Ulysses"] := "James Joyce";
	Out> True;
	In> Assoc("Henry IV", writer);
	Out> {"Henry IV","Shakespeare"};
	In> Assoc("War and Peace", writer);
	Out> Empty;

*SEE AssocIndices, [], :=, AssocDelete

*CMD AssocIndices --- return the keys in an association list
*STD
*CALL
	AssocIndices(alist)

*PARMS

{alist} -- association list to examine

*DESC

All the keys in the association list "alist" are assembled in a list
and this list is returned.

*E.G.

	In> writer := {};
	Out> {};
	In> writer["Iliad"] := "Homer";
	Out> True;
	In> writer["Henry IV"] := "Shakespeare";
	Out> True;
	In> writer["Ulysses"] := "James Joyce";
	Out> True;
	In> AssocIndices(writer);
	Out> {"Iliad","Henry IV","Ulysses"};

*SEE Assoc, AssocDelete

*CMD AssocDelete --- delete an entry in an association list
*STD
*CALL
	AssocDelete(alist, "key")
	AssocDelete(alist, {key, value})

*PARMS

{alist} -- association list

{"key"} -- string, association key

{value} -- value of the key to be deleted

*DESC

The key {"key"} in the association list {alist} is deleted. (The list itself is modified.) If the key was found and successfully deleted, returns {True}, otherwise if the given key was not found, the function returns {False}.

The second, longer form of the function deletes the entry that has both the
specified key and the specified value. It can be used for two purposes:
*	1. to make sure that we are deleting the right value;
*	2. if several values are stored on the same key, to delete the specified entry (see the last example).

At most one entry is deleted.

*E.G.

	In> writer := {};
	Out> {};
	In> writer["Iliad"] := "Homer";
	Out> True;
	In> writer["Henry IV"] := "Shakespeare";
	Out> True;
	In> writer["Ulysses"] := "James Joyce";
	Out> True;
	In> AssocDelete(writer, "Henry IV")
	Out> True;
	In> AssocDelete(writer, "Henry XII")
	Out> False;
	In> writer
	Out> {{"Ulysses","James Joyce"},
	  {"Iliad","Homer"}};
	In> DestructiveAppend(writer,
	  {"Ulysses", "Dublin"});
	Out> {{"Iliad","Homer"},{"Ulysses","James Joyce"},
	  {"Ulysses","Dublin"}};
	In> writer["Ulysses"];
	Out> "James Joyce";
	In> AssocDelete(writer,{"Ulysses","James Joyce"});
	Out> True;
	In> writer
	Out> {{"Iliad","Homer"},{"Ulysses","Dublin"}};


*SEE Assoc, AssocIndices



*CMD Flatten --- flatten expression w.r.t. some operator
*STD
*CALL
	Flatten(expression,operator)

*PARMS

{expression} -- an expression

{operator} -- string with the contents of an infix operator.

*DESC

Flatten flattens an expression with respect to a specific
operator, converting the result into a list.
This is useful for unnesting an expression. Flatten is typically
used in simple simplification schemes.

*E.G.

	In> Flatten(a+b*c+d,"+");
	Out> {a,b*c,d};
	In> Flatten({a,{b,c},d},"List");
	Out> {a,b,c,d};

*SEE UnFlatten

*CMD UnFlatten --- inverse operation of Flatten
*STD
*CALL
	UnFlatten(list,operator,identity)

*PARMS

{list} -- list of objects the operator is to work on

{operator} -- infix operator

{identity} -- identity of the operator

*DESC

UnFlatten is the inverse operation of Flatten. Given
a list, it can be turned into an expression representing
for instance the addition of these elements by calling
UnFlatten with "+" as argument to operator, and 0 as
argument to identity (0 is the identity for addition, since
a+0=a). For multiplication the identity element would be 1.

*E.G.

	In> UnFlatten({a,b,c},"+",0)
	Out> a+b+c;
	In> UnFlatten({a,b,c},"*",1)
	Out> a*b*c;

*SEE Flatten

*CMD Type --- return the type of an expression
*CORE
*CALL
	Type(expr)

*PARMS

{expr} -- expression to examine

*DESC

The type of the expression "expr" is represented as a string and
returned. So, if "expr" is a list, the string {"List"} is returned. In general, the top-level
operator of "expr" is returned. If the argument "expr" is an atom,
the result is the empty string {""}.

*E.G.

	In> Type({a,b,c});
	Out> "List";
	In> Type(a*(b+c));
	Out> "*";
	In> Type(123);
	Out> "";

*SEE IsAtom, NrArgs

*CMD NrArgs --- return number of top-level arguments
*STD
*CALL
	NrArgs(expr)

*PARMS

{expr} -- expression to examine

*DESC

This function evaluates to the number of top-level arguments of the
expression "expr". The argument "expr" may not be an atom, since
that would lead to an error.

*E.G.

	In> NrArgs(f(a,b,c))
	Out> 3;
	In> NrArgs(Sin(x));
	Out> 1;
	In> NrArgs(a*(b+c));
	Out> 2;

*SEE Type, Length

*CMD VarList --- list of variables appearing in an expression
*CMD VarListArith --- list of variables appearing in an expression
*CMD VarListSome --- list of variables appearing in an expression
*STD
*CALL
	VarList(expr)
	VarListArith(expr)
	VarListSome(expr, list)

*PARMS

{expr} -- an expression

{list} -- a list of function atoms

*DESC

The command {VarList(expr)} returns a list of all variables that appear in the
expression {expr}. The expression is traversed recursively.

The command {VarListSome} looks only at arguments of functions in the {list}. All other functions are considered "opaque" (as if they do not contain any variables) and their arguments are not checked.
For example, {VarListSome(a + Sin(b-c))} will return {{a, b, c}}, but {VarListSome(a*Sin(b-c), {*})} will not look at arguments of {Sin()} and will return {{a,Sin(b-c)}}. Here {Sin(b-c)} is considered a "variable" because the function {Sin} does not belong to {list}.


The command {VarListArith} returns a list of all variables that appear
arithmetically in the expression {expr}. This is implemented through
{VarListSome} by restricting to the arithmetic functions {+}, {-}, {*}, {/}.
Arguments of other functions are not checked.

Note that since the operators "{+}" and "{-}" are prefix as well as infix operators, it is currently required to use {Atom("+")} to obtain the unevaluated atom "{+}".

*E.G.

	In> VarList(Sin(x))
	Out> {x};
	In> VarList(x+a*y)
	Out> {x,a,y};
	In> VarListSome(x+a*y, {Atom("+")})
	Out> {x,a*y};
	In> VarListArith(x+y*Cos(Ln(x)/x))
	Out> {x,y,Cos(Ln(x)/x)}
	In> VarListArith(x+a*y^2-1)
	Out> {x,a,y^2};

*SEE IsFreeOf, IsVariable, FuncList, HasExpr, HasFunc


*CMD FuncList --- list of functions used in an expression
*CMD FuncListArith --- list of functions used in an expression
*CMD FuncListSome --- list of functions used in an expression
*STD
*CALL
	FuncList(expr)
	FuncListArith(expr)
	FuncListSome(expr, list)

*PARMS

{expr} -- an expression

{list} -- list of function atoms to be considered "transparent"

*DESC

The command {FuncList(expr)} returns a list of all function atoms that appear
in the expression {expr}. The expression is recursively traversed.

The command {FuncListSome(expr, list)} does the same, except it only looks at arguments of a given {list} of functions. All other functions become "opaque" (as if they do not contain any other functions).
For example, {FuncListSome(a + Sin(b-c))} will see that the expression has a "{-}" operation and return {{+,Sin,-}}, but {FuncListSome(a + Sin(b-c), {+})} will not look at arguments of {Sin()} and will return {{+,Sin}}.

{FuncListArith} is defined through {FuncListSome} to look only at arithmetic operations {+}, {-}, {*}, {/}.

Note that since the operators "{+}" and "{-}" are prefix as well as infix operators, it is currently required to use {Atom("+")} to obtain the unevaluated atom "{+}".

*E.G. notest

	In> FuncList(x+y*Cos(Ln(x)/x))
	Out> {+,*,Cos,/,Ln};
	In> FuncListArith(x+y*Cos(Ln(x)/x))
	Out> {+,*,Cos};
	In> FuncListSome({a+b*2,c/d},{List})
	Out> {List,+,/};

*SEE VarList, HasExpr, HasFunc

*CMD BubbleSort --- sort a list
*CMD HeapSort --- sort a list
*STD
*CALL
	BubbleSort(list, compare)
	HeapSort(list, compare)

*PARMS

{list} -- list to sort

{compare} -- function used to compare elements of {list}

*DESC

This command returns {list} after it is sorted using {compare} to
compare elements. The function {compare} should accept two arguments,
which will be elements of {list}, and compare them. It should return
{True} if in the sorted list the second argument
should come after the first one, and {False}
otherwise.

The function {BubbleSort} uses the so-called "bubble sort" algorithm to do the
sorting by swapping elements that are out of order. This algorithm is easy to
implement, though it is not particularly fast. The sorting time is proportional
to $n^2$ where $n$ is the length of the list.

The function {HeapSort} uses a recursive algorithm "heapsort" and is much
faster for large lists. The sorting time is proportional to $n*Ln(n)$ where $n$
is the length of the list.

*E.G.

	In> BubbleSort({4,7,23,53,-2,1}, "<");
	Out> {-2,1,4,7,23,53};
	In> HeapSort({4,7,23,53,-2,1}, ">");
	Out> {53,23,7,4,1,-2};

*CMD PrintList --- print list with padding
*STD
*CALL
	PrintList(list)
	PrintList(list, padding);

*PARMS

{list} -- a list to be printed

{padding} -- (optional) a string

*DESC

Prints {list} and inserts the {padding} string between each pair of items of the list. Items of the list which are strings are printed without quotes, unlike {Write()}. Items of the list which are themselves lists are printed inside braces {{}}. If padding is not specified, a standard one is used (comma, space).

*E.G.

	In> PrintList({a,b,{c, d}}, " .. ")
	Out> " a ..  b .. { c ..  d}";

*SEE Write, WriteString

*CMD Table --- evaluate while some variable ranges over interval
*STD
*CALL
	Table(body, var, from, to, step)

*PARMS

{body} -- expression to evaluate multiple times

{var} -- variable to use as loop variable

{from} -- initial value for "var"

{to} -- final value for "var"

{step} -- step size with which "var" is incremented

*DESC

This command generates a list of values from "body", by assigning
variable "var" values from "from" up to "to", incrementing
"step" each time. So, the variable "var" first gets the value
"from", and the expression "body" is evaluated. Then the value
"from"+"step" is assigned to "var" and the expression "body"
is again evaluated. This continues, incrementing "var" with "step"
on every iteration, until "var" exceeds "to". At that moment, all
the results are assembled in a list and this list is returned.

*E.G.

	In> Table(i!, i, 1, 9, 1);
	Out> {1,2,6,24,120,720,5040,40320,362880};
	In> Table(i, i, 3, 16, 4);
	Out> {3,7,11,15};
	In> Table(i^2, i, 10, 1, -1);
	Out> {100,81,64,49,36,25,16,9,4,1};

*SEE For, MapSingle, .., TableForm

*CMD TableForm --- print each entry in a list on a line
*STD
*CALL
	TableForm(list)

*PARMS

{list} -- list to print

*DESC

This functions writes out the list {list} in a better readable form, by
printing every element in the list on a separate line.

*E.G.

	In> TableForm(Table(i!, i, 1, 10, 1));

	1
	 2
	 6
	 24
	 120
	 720
	 5040
	 40320
	 362880
	 3628800
	Out> True;

*SEE PrettyForm, Echo, Table

*CMD GlobalPop --- restore variables using a global stack
*CMD GlobalPush --- save variables using a global stack
*STD
*CALL
	GlobalPop(var)
	GlobalPop()
	GlobalPush(expr)

*PARMS

{var} -- atom, name of variable to restore from the stack

{expr} -- expression, value to save on the stack

*DESC

These functions operate with a global stack, currently implemented as a list that is not accessible externally (it is protected 
through {LocalSymbols}).

{GlobalPush} stores a value on the stack. {GlobalPop} removes the last pushed value from the stack. If a variable name is given, the variable is assigned, otherwise the popped value is returned.

If the global stack is empty, an error message is printed.

*E.G.

	In> GlobalPush(3)
	Out> 3;
	In> GlobalPush(Sin(x))
	Out> Sin(x);
	In> GlobalPop(x)
	Out> Sin(x);
	In> GlobalPop(x)
	Out> 3;
	In> x
	Out> 3;

*SEE Push, PopFront