view lab3/compose.p @ 1:b5139af1a420 tip basis

Fixed permissions on compile scripts
author Mike Spivey <mike@cs.ox.ac.uk>
date Fri, 13 Oct 2017 17:27:58 +0100
parents bfdcc3820b32
children
line wrap: on
line source
(* lab3/compose.p *)

var p;

proc compose(f, g);
  proc fg(x);
  begin
    return f(g(x))
  end;
begin
  return fg
end;

proc dummy(f, g);
  var a0, a1, a2, a3, a4, a5, a6, a7, a8, a9;
begin
  return compose(f, g)
end;

proc add2(x); begin return x+2 end;
proc square(x); begin return x * x end;

begin
  p := dummy(square, add2);
  print p(2); newline
end.