raz / conform / run / Copy.raz

29 lines · 742 B · raw · history · last change d8137081

1module Copy;
2import Out;
3type P = record x, y: I32; end;
4var a: [10]U8; b: []U8; ps: [4]P; qs: [2]P; big: [100]I64; i: INT;
5proc show(s: []U8);
6begin
7 Out.str(s); Out.ln;
8end;
9proc main*;
10begin
11 a := "abcdefghij";
12 COPY(a[2..10], a[0..5]); (* overlap, up *)
13 show(a[0..10]);
14 a := "abcdefghij";
15 COPY(a, a[3..10]); (* overlap, down *)
16 show(a[0..10]);
17 b := a[0..10];
18 COPY(b[8..10], "XY");
19 show(a[0..10]);
20 COPY(b, "");
21 qs := [{x: 1, y: 2}, {x: 3, y: 4}];
22 COPY(ps[1..4], qs);
23 Out.int(I64(ps[1].x + ps[2].y)); Out.ln;
24 for i := 0 to 99 do big[i] := i; end;
25 COPY(big[1..100], big[0..99]);
26 Out.int(big[99] + big[1] + big[0]); Out.ln;
27 COPY(a[0..2], "abc");
28end;
29end Copy.