// retoor <retoor@molodetz.nl>
import "scheduler" for Scheduler, Future
var multiplier = 10
var scale = async { |x| x * multiplier }
System.print(await scale(5)) // expect: 50
multiplier = 100
System.print(await scale(5)) // expect: 500
var prefix = "Result: "
var format = async { |x| prefix + x.toString }
System.print(await format(42)) // expect: Result: 42
var outer = "outer"
var fn = Fn.new {
var inner = "inner"
var capture = async { |x| outer + "-" + inner + "-" + x }
return await capture("arg")
}
System.print(fn.call()) // expect: outer-inner-arg