-- Example of function types and variables -- in Ada on page 211 of -- Kenneth C. Louden, Programming Languages -- Principles and Practice 2nd Edition -- Copyright (C) Brooks-Cole/ITP, 2003 with Text_IO; use Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure functype is type IntFunction is access function (x:integer) return integer; -- "access" means pointer in Ada function square (x: integer) return integer is begin return x * x; end square; function evaluate (g: IntFunction; value: integer) return integer is begin return g(value); end evaluate; f: IntFunction := square'access; -- note use of access attribute to get pointer to square begin put(evaluate(f,3)); -- evaluates to 9 new_line; end;