Эх сурвалжийг харах

update fig 9.8 to use begin

Jeremy G. Siek 2 жил өмнө
parent
commit
f8ea247727
1 өөрчлөгдсөн 13 нэмэгдсэн , 10 устгасан
  1. 13 10
      book.tex

+ 13 - 10
book.tex

@@ -17783,21 +17783,24 @@ print(g(11) + h(15))
 \end{lstlisting}
 $\Rightarrow$
 \begin{lstlisting}
-def lambda_0(fvs_1:tuple[bot,int,tuple[int]],z:int) -> int:
+def lambda_0(fvs_1 : tuple[bot,int,tuple[int]], z : int) -> int:
   x = fvs_1[1]
   y = fvs_1[2]
-  return x + y[0] + z
+  return (x + y[0] + z)
 
-def f(fvs_2:bot, x:int) -> tuple[Callable[[tuple[],int], int]]
-  y = (777,)
-  y[0] = 4
-  return (lambda_0, x, y)
+def f(fvs_2 : bot, x : int) -> tuple[Callable[[tuple[],int], int]]:
+  y = (4,)
+  return closure{1}({lambda_0}, x, y)
 
 def main() -> int:
-  g = (let clos_3 = (f,) in clos_3[0](clos_3, 5))
-  h = (let clos_4 = (f,) in clos_4[0](clos_4, 3))
-  print((let clos_5 = g in clos_5[0](clos_5, 11))
-        + (let clos_6 = h in clos_6[0](clos_6, 15)))
+  g = begin: clos_3 = closure{1}({f})
+             clos_3[0](clos_3, 5)
+  h = begin: clos_4 = closure{1}({f})
+             clos_4[0](clos_4, 3)
+  print((begin: clos_5 = g
+                clos_5[0](clos_5, 11)
+       + (begin: clos_6 = h
+                 clos_6[0](clos_6, 15))))
   return 0
 \end{lstlisting}
 \fi}