- 论坛徽章:
- 0
|
可以参考 “The Scheme Programming Language" 的 2.5 [点这里]
相关的是这一段:
As mentioned above, the general form for lambda is a bit more complicated than the form we saw earlier, in that the formal parameter specification, (var ...), need not be a proper list, or indeed even a list at all. The formal parameter specification can be in any of the following three forms.
* a proper list of variables, (var1 ... varn), such as we have already seen,
* a single variable, varr, or
* an improper list of variables, (var1 ... varn . varr).
In the first case, exactly n actual parameters must be supplied, and each variable is bound to the corresponding actual parameter. In the second, any number of actual parameters is valid; all of the actual parameters are put into a single list and the single variable is bound to this list. The third case is a hybrid of the first two cases. At least n actual parameters must be supplied. The variables var1 ... varn are bound to the corresponding actual parameters, and the variable varr is bound to a list containing the remaining actual parameters. In the second and third cases, varr is sometimes referred to as a "rest" parameter because it holds the rest of the actual parameters beyond those that are individually named.
[ 本帖最后由 win_hate 于 2009-1-25 22:42 编辑 ] |
|