3 ms·
You might like Apple's Swift: class Example { let ExtraMul = 5 } let weakly = Example() let squareAndABit : Int -> Int = { [weak weakl
by archgrove 12y ago
You might like Apple's Swift:
class Example {
let ExtraMul = 5
}
let weakly = Example()
let squareAndABit : Int -> Int = { [weak weakly] in $0 * $0 * weakly!.ExtraMul }
squareAndABit(2) // 20
Positional lambda arguments, implicit returns for single expression arguments, capture lists if you want to alter the default capture mode. It's got really rather nice first class function support.