Baseline: tree as shared
This commit is contained in:
1679 files changed
+1024562
No files matched your search
@@ -0,0 +1,14 @@
|
||||
# probe: the same with a capturing lambda: the compiler names its type def(x: Int) -> Int, with no thin
|
||||
# expect: compile-error
|
||||
# note: kept as a checker test; the code below is exactly what godbolt rejected
|
||||
def apply_all(xs: List[Int], f: def(Int) -> Int) -> List[Int]:
|
||||
var out = List[Int]()
|
||||
for x in xs:
|
||||
out.append(f(x))
|
||||
return out^
|
||||
|
||||
|
||||
def main():
|
||||
var xs: List[Int] = [1, 2, 3, 4]
|
||||
var offset = 10
|
||||
print(apply_all(xs, lambda (x: Int) -> Int: x + offset))
|
||||
Reference in new issue
Block a user