单词 | Lambda expression |
例句 | 1 Parameters: Retrieve the parameters of the lambda expression. 2 Here, the first lambda expression is the mapper (mapping each element to its size), and the second lambda expression is the reducer, which takes two sizes and adds them. 3 The first line defines a lambda expression and binds it to the symbol total. 4 Because the lambda expression has the right argument and return types, the compiler verifies that it can be converted into a Comparator and generates the appropriate code for doing so. 5 Finally, the last expression applies the lambda expression to the list containing (101 102). 6 In this particular example, a method reference is a clearer expression of what we mean than a lambda expression, but the idea is the same. 7 Item 2 is interesting, because it means that you can write a lambda expression into an expression tree, reason about it, etc, and then turn it into a callable delegate. 8 For example, the following code declares a Comparator that compares strings by length and uses a lambda expression to define the Comparator:. 9 If capture of mutable locals were allowed, the platform would need to extend the local variable's lifetime for as long as the dynamic lifetime of any lambda expression that captures it. 10 Function types are indeed the natural way to represent the type of a lambda expression, but unfortunately they interact badly with an existing language "feature": erasure. 11 Perhaps the most common use of higher-order functions is the lambda expression, which is Lisp's version of a closure. 12 An expression tree is a data representation of the lambda expression in a form that is easy for you to read and reason about the lambda expression in. 13 In this code sample, the first line creates a lambda expression and does the magic to assign it to a callable delegate f, and the second line invokes f and returns 20. |
随便看 |
|
英语例句大全共收录104207条中英例句词条,基本覆盖所有常用英文单词的例句、长难句及中文翻译,是不可多得的英语学习材料。