(* TEST: [-asc -tc] *) (* Type definitions *) #include "std.alpha" (* mapping type *) type string2int: string -> integer (* array of functions *) type funArray: 1 -> string2int (* record of functions *) type funRec: [ string2int: f; string2int: g ] type int2int: integer -> integer (* function returning function *) type integer_2_int2int: integer -> int2int (* function returning function *) type string2int_2_integer: string2int -> integer type iXiXc: [integer: a; integer: b; character: c] type iic2b: iXiXc -> Boolean (* Function declarations using the above type definitions *) function a: int2int function b: integer_2_int2int function c: string2int_2_integer function d: iic2b d(x,y,z) := { [string: s] return true; } function entry: string2int a(x) := { [string : s] x:= printInteger(x); return 0; } b(x) := { [integer: i] i := x; return a; } c(x) := { [string: s] s := "Hi!"; return 3; } (* Function definition entry is the first function called *) entry(arg) := { [integer: result; int2int: f; integer: temp] temp := 7; f := b(temp); result := f(temp); (*result := c(f);*) if (d(1,2,'c')) then { result := 0; } else { [ Boolean : b] result := entry("hello"); } (*result := c(f);*) return result; }