higherNested.wacc 347 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
24
25
26
27
28
29
# 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} i(int{int}{int{int}} e, int{int} a) is
    int{int} k = call e(a);
    return k
  end

  int{int} x = call i(f, g);
  int y = call x(4);
  println y
end