blob: 79e24c30267e754c363578f28acb2f29cdbe0c9b (
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
|
$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
@@;
$p = Python::f(Callable<(Int32)->DynamicLinear<Int32>>, $s);
$c = Python::g(Callable<(DynamicLinear<Int32>,Int32)->Int32>, $s);
$a = $p(1);
select $c($a,0),$c($a,1);
|