higherOrderSimple.wacc 245 Bytes
Newer Older
Jack Q's avatar
Jack Q committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# basic higher order function declaration and use

# Output:
# 2

# Exit:
# 0

# Program:

begin
  int g(int a) is
    return a
  end

  int{int} f(int{int} d) is
    return d
  end

  int{int} x = call f(g);
  int y = call x(2);
  println y
end