哑元参数

某个参数如果在子程序或函数中没有用到,那就被称为哑元。这是程序设计语言中的一个术语,不是FORTRAN独有的:)

函数的形参又称“哑元”,实参又称“实元”。

广义,狭义的理解不同而已:

函数过程 
FUNCTION 函数名(哑元表) RESULT(结果名) 
... 
END FUNCTION 函数名

子程序 
[RECURSIVE] SUBROUTINE 过程名(哑元表)
 ... 
END [[SUBROUTINE] 过程名]  

调用:CALL 过程名(实元表

 

呵呵,这样啊。那看来咱用的教材不一样:)
在C++的运算符重载中,就会用到哑元以区分i++与++i的区别:)

且在C/C++中,哑元是可以没有变量名的,如:
int fun(int,int a)
{
    return a/10*10;
}
则在调用时,第一个参数随便给一个值就行了,因为它终会被丢弃:)

 

哑元   :   dummy

表示虚无的元素,没有实际空间,甚至连名字都可以没有,它只有联系上实元才有意义。

C函数中明显具有哑元特性的应该是可变参数表,如
int   printf(
      const   char   *format   [,
      argument]...  
);

dummy argument 又叫哑元变量 声明并定义一个函数 void f(int) { } 函数f有一个int参数,但没有给这个参数声明变量,所以在函数的实现中你永远 也无法使用这个函数,这个参数只是一个占位符,一般是因为兼容性方面的原因 这样做的。 又或者在++操作符定义中也需要这种占位符。 实际变量 就不用解释了吧?
如:

声明并定义一个函数
void   f(int)
{
}

函数f有一个int参数,但每个给这个参数声明变量,所以在函数的实现中你永远
也无法使用这个函数,这个参数只是一个占位符,一般是因为兼容性方面的原因
这样做的。

Good   Luck.
如:

声明并定义一个函数
void   f(int)
{
}

函数f有一个int参数,但每个给这个参数声明变量,所以在函数的实现中你永远
也无法使用这个函数,这个参数只是一个占位符,一般是因为兼容性方面的原因
这样做的。

Good   Luck.
如:

声明并定义一个函数
void   f(int)
{
}

函数f有一个int参数,但每个给这个参数声明变量,所以在函数的实现中你永远
也无法使用这个函数,这个参数只是一个占位符,一般是因为兼容性方面的原因
这样做的。

Good   Luck.
如:

声明并定义一个函数
void   f(int)
{
}

函数f有一个int参数,但每个给这个参数声明变量,所以在函数的实现中你永远
也无法使用这个函数,这个参数只是一个占位符,一般是因为兼容性方面的原因
这样做的。

Good   Luck.

 

 

 

Dummy variables refer to "proxy" variables or numeric stand-ins for qualitative facts in a regression model. In regression analysis, the dependent variables are influenced not only by quantitative variables (income, output, prices, etc.), but also by qualitative variables (gender, religion, geographic region, etc.) Dummy independent variables take the value of 0 or 1. Hence, they are also called binary variables. A dummy explanatory variable with a value of 0 will cause that variable's coefficient to disappear and a dummy with a value 1 will cause the coefficient to act as a supplemental intercept in a regression model. For example, suppose Gender is one of the qualitative variables relevant to a regression. Then, female and male would be the categories included under the Gender variable. If female is assigned the value of 1, then male would get the value 0 (or vice-versa). [1]

Thus, a dummy variable can be defined as a qualitative representative variable incorporated into a regression, such that it assumes the value 1 whenever the category it represents occurs, and 0 otherwise. [2] Dummy variables are used as devices to sort data into mutually exclusive categories (such as male/female, smoker/non-smoker, etc.) [3]

Dummy variables are generally used frequently in time series analysis with regime switching, seasonal analysis and qualitative data interpretation. Dummy variables are involved in studies for economic forecasting, bio-medical studies, credit scoring, response modelling, etc. Dummy variables may be incorporated in traditional regression methods or newly developed modeling paradigms.[1]

Synonyms for the term dummy variables include design variables, Boolean indicators, proxies, indicator variables, categorical variables and qualitative variables. [1] [3]

In mathematics, and in other disciplines involving formal languages, including mathematical logic andcomputer science, a free variable is a notation that specifies places in an expression wheresubstitution may take place. The idea is related to a placeholder (a symbol that will later be replaced by some literal string), or a wildcard character that stands for an unspecified symbol.

The variable x becomes a bound variable, for example, when we write

'For all  x, ( x + 1) 2 =  x 2 + 2 x + 1.'

or

'There exists  x such that  x 2 = 2.'

In either of these propositions, it does not matter logically whether we use x or some other letter. However, it could be confusing to use the same letter again elsewhere in some compound proposition. That is, free variables become bound, and then in a senseretire from being available as stand-in values for other values in the creation of formulae.

In computer programming, a free variable is a variable referred to in a function that is not a local variable or an argument of that function.[1] An upvalue is a free variable that has been bound (closed over) with a closure. Note that variable "freeness" only applies in lexical scoping: there is no distinction, and hence no closures, when using dynamic scope.

The term "dummy variable" is also sometimes used for a bound variable (more often in general mathematics than in computer science), but that use creates an ambiguity with the definition of dummy variables in regression analysis.


来自博主:http://blog.sina.com.cn/coefficient

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值