raz / test / pretty / Messy.raz

59 lines · 916 B · raw · history · last change bc22ce64

1(* A module laid out badly. *)
2 module Messy;
3import Out,Rt;
4
5const
6max* =10;
7 min=-1;
8
9type
10 Pair* = record
11 a*,b: I64; (* two numbers *)
12 end;
13 Shape = variant
14 circle(r: I64);
15 dot;
16 end;
17
18 (* the bigger *)
19 proc max2*(a,b:I64):I64;
20var m : I64;
21 begin
22if a>b then m:=a;
23 elsif a=b then
24 m :=a ;
25 else
26 m:= b;end;
27 return m;
28 end;
29
30proc area(s: Shape): I64;
31begin
32match s of
33 | circle(r): return 3*r*r;
34| dot:
35 return 0;
36 end;
37end;
38
39proc main*;
40var i,s:I64; p: Pair;
41begin
42 s:=0;
43 for i:=-3 to max-1 do s:=s+i*2- -1;end;
44 repeat
45 s := s-1 ;
46 until s<0;
47 if (s # -1) or (max2(3,4) # 4)
48 or (area({dot}) # 0) then Rt.stop("Messy"); end;
49 s:=s&~3|s xor 1 & max
50 | 4;
51 p := {a: -s, b:2};
52 Out.int(p.a); (* the first *)
53 Out.ln;
54 (* and done:
55 a comment that moves
56 with its line *)
57end;
58
59end Messy.