+Calculator and code looks
[lineal.git] / doc / crop.html
blob5589bbeec9de3e1a0e37d2eaa934066d653a8e22
2 <html>
3 <head>
4 <title>Cropping Structures</title>
5 </head>
6 <body>
7 <div><a href="./index.html">back to doc index</a></div>
8 <p>Intended for use with the <a href="./concatenating.html">cat</a>
9 function, crop can do some powerful things. Crop accepts a number and
10 the data structure from which you want to crop.</p>
11 <p>Start by initializing some variables.</p>
12 <table width="100%" border="1"
13 style="text-align: center; font-family:monospace">
14 <tr>
15 <td width="25%"><b>Input</b></td>
16 <td width="15%"><b>Output</b></td>
17 <td><b>Explanation</b></td>
18 </tr>
19 <tr>
20 <td>(store "A" (vcat (cat 3 5 7) (cat 2 4 6) 2))</td>
21 <td>[3 5 7]<br/>[2 4 6]<br/>[2 2 2]</td>
22 </tr>
23 <tr>
24 <td>(store "u" (vcat 1 2 3))</td>
25 <td>(1, 2, 3)</td>
26 </tr>
27 <tr>
28 <td>(crop 2 A)</td>
29 <td>[3 5]<br/>[2 4]<br/>[2 2]</td>
30 <td>Get the 2 left columns <b>A</b>.</td>
31 </tr>
32 <tr>
33 <td>(vcrop A 2)</td>
34 <td>[3 5 7]<br/>[2 4 6]</td>
35 <td>Get the bottom 2 rows of <b>A</b>.</td>
36 </tr>
37 <tr>
38 <td>(crop A 1)</td>
39 <td>(7, 6, 2)</td>
40 <td>Only one column vector cropped from the right of <b>A</b>,
41 it is automatically transformed into a vector.</td>
42 </tr>
43 <tr>
44 <td>(vcrop 1 u)</td>
45 <td>1</td>
46 <td>Like the previous example, only one element is cropped from
47 vector <b>u</b> so it is returned as a plain number.<br/>
48 <b>NOTE:</b> To get this effect, you must use vcrop instead
49 of crop.</td>
50 </tr>
51 <tr>
52 <td>(crop 1 u)</td>
53 <td>(1, 2, 3)</td>
54 <td>Using crop on a vector just returns it.</td>
55 </tr>
56 </table>
57 </body>
58 </html>