comparison lab3/compose.p @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:bfdcc3820b32
1 (* lab3/compose.p *)
2
3 var p;
4
5 proc compose(f, g);
6 proc fg(x);
7 begin
8 return f(g(x))
9 end;
10 begin
11 return fg
12 end;
13
14 proc dummy(f, g);
15 var a0, a1, a2, a3, a4, a5, a6, a7, a8, a9;
16 begin
17 return compose(f, g)
18 end;
19
20 proc add2(x); begin return x+2 end;
21 proc square(x); begin return x * x end;
22
23 begin
24 p := dummy(square, add2);
25 print p(2); newline
26 end.