1
1
/* ======================================================================== */
2
2
/* file: array.dem */
7
THIS BATCH FILE ILLUSTRATES VARIOUS NEW ARRAY CAPABILITIES AVAILABLE
9
WHICH ARE COMPLETELY COMPATIBLE WITH THE EXISTING SCHEME.
11
MAPPING IN THIS CONTEXT MEANS DISTRIBUTE THE NAME OVER THE STRUCTURE
13
INDICATED BY THE SUBSCRIPTS.
15
INCLUDED ARE IMPLIED MAPPING USING LISTS AS SUBSCRIPTS,
17
GENERALIZED ELEMENT EXTRACTION FROM LIST OR MATRIX STRUCTURES,
19
IMPLIED ASSIGNMENT MAPPING, AND RECURSIVE LIST STRUCTURES.
21
COMPATIBILITY WITH HASHED ARRAYS AND DECLARED ARRAYS IS SHOWN.
23
FIRST CONSIDER USING LIST STRUCTURES AS SUBSCRIPTS. A,B, AND C
25
BELOW CAN BE ARRAYS, HASHED ARRAYS, LIST STRUCTURES, MATRICES OR
32
(A[1]:FIRST,A[2]:SECOND);
39
MIDDLE&&MAT:MATRIX([Q,V],[W,U]);
41
MAT[[1,2],[1,2]],EVAL;
45
ASSIGNMENT MAPS CAN BE CARRIED OUT WITH "::" OR (''FOO):
59
RECURSIVE LIST STRUCTURES:
70
MAPPING A FUNCTION ON A LIST STRUCTURE
72
FULLMAPL(FOO,[[A,B],[C,D]]);
73
FULLMAPL(FUNC,'[AA+BB,'[AA,BB],[AA,BB],[3,4]]);
74
DSL:'[AS+BS,[DS,ES],'[GS,HS],144];
82
TO COME: SHAPING, GENERAL REDUCTION, GENERAL CONTRACTION OR EXPANSION
84
(INNER AND OUTER PRODUCTS), ARITHMETIC, THE WORLD, THE UNIVERSE
7
this batch file illustrates various new array capabilities available
9
which are completely compatible with the existing scheme.
11
mapping in this context means distribute the name over the structure
13
indicated by the subscripts.
15
included are implied mapping using lists as subscripts,
17
generalized element extraction from list or matrix structures,
19
implied assignment mapping, and recursive list structures.
21
compatibility with hashed arrays and declared arrays is shown.
23
first consider using list structures as subscripts. a,b, and c
25
below can be arrays, hashed arrays, list structures, matrices or
32
(a[1]:first,a[2]:second);
39
middle&&mat:matrix([q,v],[w,u]);
41
mat[[1,2],[1,2]],eval;
45
assignment maps can be carried out with "::" or (''foo):
59
recursive list structures:
70
mapping a function on a list structure
72
fullmapl(foo,[[a,b],[c,d]]);
73
fullmapl(func,'[aa+bb,'[aa,bb],[aa,bb],[3,4]]);
74
dsl:'[as+bs,[ds,es],'[gs,hs],144];
82
to come: shaping, general reduction, general contraction or expansion
84
(inner and outer products), arithmetic, the world, the universe