blob: 09610de9aa39d1e5b877ef9e8268b08d72caaef2 (
plain) (
blame)
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
|
$s = @@
def f(x):
class Once:
def __init__(self, v):
self.v = v
self.extracted = False
def extract(self):
assert not self.extracted
self.extracted = True
ret = self.v
self.v = None
return ret
return Once(x + 1)
def g(x,n):
return x.extract() + n
@@;
$l = DynamicLinearType(Int32);
$p = Python::f(Callable<(Int32)->$l>, $s);
$c = Python::g(Callable<($l,Int32)->Int32>, $s);
$a = $p(1);
select $c($a,0),$c($a,1);
|